0

I wish to do an update_by_query request using my python elasticsearch client. I wish to query with index, type and a field which is NOT id. Based on that field I wish to update some of the other fields but if that query returns no results, a new document should be created with the aforementioned index and type.

I could do a search and then update but I wish to do this with one query only. Also I would like to execute multiple such operations using helpers.bulk(es, result) where es is the elasticsearch clientand result is a list of jsons. Elasticsearch Version is 5.4

6
  • Can we see what you have done so far and where you are blocked? Commented May 10, 2017 at 12:05
  • @asettouf I am blocked in the sense I can't find any documentation or exxample on how to implement the above whatsoever Commented May 11, 2017 at 9:24
  • I'm in the same boat as @SagnikSinha, there's no documentation on this. Wondering if it is possible even outside the python dsl Commented Feb 1, 2018 at 0:25
  • Painless scripting could do the job if python doesn't work for you Commented Mar 27, 2020 at 22:45
  • @cluis92 Any resources or snippets in the mentioned direction, IMO painless inline scripting will be executed on the queried documents that are available in the index Commented Sep 23, 2020 at 14:30

0

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.