Elasticsearch remove column/attribute from a document

(Waleed Malik) #1


I am using elastic-search Java API in my spring application. I have created multiple elastic-search repositories in it. Now what i want to do is against a certain repository lets say TestRepository, i want to remove a certain attribute from all its columns.

For example, TestRepository has column A and B, and the data is already stored in elastic-search i want to remove column B from all the documents corresponding to this repository. How can i achieve this ?

I have read about Update API but i think that won't be suitable in my scenario since i can't apply that to running instance of my application.

(Lee Hinman) #2

Hi Waleed,

I would recommend you check out the update-by-query API: https://www.elastic.co/guide/en/elasticsearch/reference/6.4/docs-update-by-query.html

You could specify a script that would take the existing source object and remove the key corresponding to the field you want to remove from the document.

(system) #3

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