GET usernested/_search{ "query": { "nested": { "path":"tags", "query": { "bool": { "must": [ { "term": { "tags.brandid":"93a8296c-5b64-49ea-bd92-b19192def2e9" } }, { "term": { "tags.site":"163" } }]}}}}}//create A new index as the test data using post _reindex{"source": { "index":"usernested", "query": { "nested": { "path":"tags", "query": { "bool": { "must": [ { "term": { "tags.brand":"c55fd643-1333-4647-b898-fb3e5e4e6d67" } }, { "term": { "tags.site":"163" } } ] } } } } }, "dest": { "index":"new_usernested"}}//query Get new_usernested/_search{ "query": { "nested": { "path":"tags", "query": { "bool": { "must": [ { "term": { "tags.brand":"c55fd643-1333-4647-b898-fb3e5e4e6d67" } }, { "term": { "tags.site":"163"}} ]}}}}}//update a nested document get usernested based on the condition/_update_by_query{ "query": { "nested": { "path":"tags", "query": { "bool": { "must": [ { "term": { "tags.brand":"c55fd643-1333-4647-b898-fb3e5e4e6d67" } }, { "term": { "tags.site":"163" } } ] } } } }, "script": { "inline":"for (e in Ctx._source.tags) {e.brand = ' test2 ';}"//update nested field
//"inline": "ctx._source.userid = ' TestID '"//update normal field}}
Elasticsearh update nested fields (array arrays). How do I copy a (index) to the new index to update by query a nested fields data for elasticsearch based on the query criteria?