Find and replace in elasticsearch all documents -


i wanted replace single username in elasticsearch index documents. there api query ?

i tried searching multiple couldn't find. 1 has idea?

my scenario:

curl -xpost 'http://localhost:9200/test/movies/' -d '{"user":"mad", "role":"tester"}'  curl -xpost 'http://localhost:9200/test/movies/' -d '{"user":"bob", "role":"engineer"}'  curl -xpost 'http://localhost:9200/test/movies/' -d '{"user":"cat", "role":"engineer"}'  curl -xpost 'http://localhost:9200/test/movies/' -d '{"user":"bob", "role":"doctor"}'

i have above data in index called "test" , type "movies". here wanted replace "bob" name "alice".

thanks

update-by-query way go.

post /test/movies/_update_by_query {   "script": {     "inline": "ctx._source.user = 'alice'"   },   "query": {     "term": {       "user": "bob"     }   } } 

note: make sure enable dynamic scripting in order work.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -