Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update only specific field value in elasticsearch

Is it possible to update some specific fields value in elasticsearch with out overwriting other fields. ?

like image 384
Johnsa Philip Avatar asked Oct 24 '13 10:10

Johnsa Philip


People also ask

Can we update data in Elasticsearch?

The script can update, delete, or skip modifying the document. The update API also supports passing a partial document, which is merged into the existing document. To fully replace an existing document, use the index API.


1 Answers

As a codebased contribution to this answer, the following query may be used:

POST /index/type/100100471/_update {     "doc" : {         "yourProperty" : 10000     } } 

This query updates yourProperty property only.

As a result, this response appears:

{    "_index": "index",    "_type": "type",    "_id": "100100471",    "_version": 1,    "_shards": {       "total": 0,       "successful": 1,       "failed": 0    } } 
like image 113
pedrouan Avatar answered Sep 18 '22 18:09

pedrouan