xxestter
xxestter

Reputation: 509

Elasticsearch DSL Query for Update

I understand that I am able to update a particular document by http://localhost:9200/[index_name]/[index_type]/[_id], but I have document where the _id has # symbols which Sense couldn't find them.

Understand that the Query DSL will be able to perform a search where I am able to indicate the _id not in the URL. Resource: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-ids-query.html

Can I check with you, how can I do the same for updating document?

Upvotes: 0

Views: 1021

Answers (2)

Val
Val

Reputation: 217254

If you don't want to put the ID in the URL, the only option you have is to use the update by query API, like this:

POST index/_update_by_query
{
  "query": {
    "ids": {
      "values": ["2323#23423"]
    }
  },
  "script": {
    "source": "do some update here"
  }
}

Upvotes: 2

Biplab
Biplab

Reputation: 139

Use localhost:9200/index/type/ID%23, %23 for #

So if '_id' is 10, url will look like localhost:9200/index/type/10%23

Upvotes: 0

Related Questions