Need help with update operations in elastic search

(udit agarwal) #1

In the below given use case, I want to update the name field and change its value to “My name is Mathews Fox”

"_index": "log",
"_type": "info log",
"_id": "7715ed0b-853e-4d28-b2e3-99156d6dcb3a",
"_score": 5.93148,
"_source": {
"Name": "My name is Lucius fox",

(David Pilato) #2
PUT log/info log/7715ed0b-853e-4d28-b2e3-99156d6dcb3a
  "Name": "My name is Mathews fox",

(udit agarwal) #3

Thanks David!
The problem I have at hand is that I wouldn't be aware of id. I want to search on the substring "Lucius" in the "Name" field and if there is a match, then replace "Lucius" with "Mathews" in the "Name" field.

(David Pilato) #4

So this?

(udit agarwal) #5

I have already tried this. Using this, I can update the complete value of a field but not the substring. I should be first able to identify whether the field contains a particular substring or not and if it does that replace it with the replacement string.

(David Pilato) #6

Share what you tried and we can probably help from there.

A full recreation script as described in About the Elasticsearch category would help. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

(system) closed #7

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