First, the demand
You need to implement a field in the project to delete the document and delete a property of the specified field.
Take document TEST/DOCUMENT/1 as an example:
{ "_index":"Test", "_type":"Document", "_id":"1", "_score":1, "_source":{ "class":"Com.test.data", "ID":1, "Items":[{"class": "Com.test.data", "ID": 1 }], "lastupdated":"2016-07-22t11:26:56z", "ProcessInstance":{"class": "Com.test.data", "ID": 1 }, "Tianshu":0.5, "Bianhao":"askaa3333a" }}
Deleting "Bianhao" is deleting a field and deleting "ProcessInstance" is an attribute of deleting field.
Ii. Deletion of field
client.prepareUpdate("test""document""1").setScript(new Script( "ctx._source.remove(\"bianhao\")",ScriptService.ScriptType.INLINE, null, null)).get();
Third, delete the attribute of field
client.prepareUpdate("test""document""1").setScript(new Script( "ctx._source.processInstance.remove(\"id\")",ScriptService.ScriptType.INLINE, null, null)).get();
Iv. fild Attribute Array
No method is found for the time being updated.
Elasticsearch Java API (ix)--Delete the field of the document and the properties of the field