1

I use the following query to update some weight filed in matched docs. I need to get the list of updated docs id but I don't know how to do that?

    POST v1_shingle_analyzer/_update_by_query
{
    "script" : {
        "source": "ctx._source.content_completion.weight ++",
        "lang": "painless",
        "_source":true,
        "_source_includes":"_id"
    
    },
    "query": {
    "ids": {
      "values": ["ad22784cde0cecab176811ca9d77e7c2","dssdg784cde0cecab176811ca9fgdfg"]
     
    }
  }
}
4
  • I don't think there is a way. You can query the Id's again to check whether it updated. Commented Jun 20, 2020 at 14:47
  • @Gibbs Are you sure? If you are, post it as answer and I will accept it Commented Jun 21, 2020 at 6:01
  • Sure. I will do little more research and give you a detailed answer. Commented Jun 21, 2020 at 6:04
  • I also don't think there is a way of doing this, I less efficient and I guess the only way of doing is first get version of all the document, and after updation of the index see if version is updated for those Commented Jun 21, 2020 at 8:20

1 Answer 1

3

References this, this legend answer, this plugin and few ES forum posts, JIRAs.

Short answer:

There is no direct way of doing this. You may need to query again with the IDs to check whether it changed.

Detailed answer:

As per the documentation, Response doesn't have a field to return the updated IDs.

The plugin mentioned is deprecated/dropped the support to context as per the GitHub link. But I think that

  1. you can look at the source code to figure out a way to get the IDs updated If it really matters.
  2. I see here that there is a response option. We can set three values. But it doesn't say anything about returning IDs. It says options related to which shard, what type is updated, etc.. You can look at this if there is anyway to tweak this.

Kindly let me know for more information.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.