scalaelasticsearchelastic4s

ElasticSearch: change field value using query in code


I have a code for editing records in ElasticSearch repository:

client.execute {
      update(id).in(indexName).script("ctx._source." + query)
}

and I don't know what string to give to query variable.
The index looks like this:

[
  {
    "lang": "ru",
    "deleted": false,
    ...
  }
]

I should change deleted to true


Solution

  • Yes you are right

    "deleted = true"