Find by query and push to array in Elastic search

I store data in the elastic search like this:

{
"_index": "my_index",
"_type": "doc",
"_id": "6lDquGEBFRQVe0x93eHk",
"_version": 1,
"_score": 1,
"_source": {
"ID_Number": "6947503728601",
"Userrname":"Jack.m07",
"name": "Jack",
"photos": ["img/one.png"]
}
}

I want find user by ID_Number and push new value to Photos

e.g)"photos": ["img/one.png","img/two.png"]

How can I implement this?what is the query?

What would be better is to use your id number as the _id field as well.

In which case it will be super straight forward to send a new version of the document.

Otherwise you need to call the update by query API. But it's slower.

1 Like

Thanks Dear @dadoonet it's very helpfull
can you help me in an other problem?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.