I want to delete a field of a doc, I tried some ways but failed. Is there a query DSL or api I can use?
Just send a new version of your doc without the field...
Thanks a lot. If there is no other way to implement it. I will try this way.
It's the easiest way. Is there anything wrong with that method from your point of view?
You could use the update API with an update script. This eliminates a round trip at the cost of having to deal with scripting.
I worry about the conflict of the update, may be some threads update the doc at the same time. But It seems this is the only way. I will fetch the old doc first, remember the old version, and post the new doc without the field I want to remove, and then check the version returned.
You can use versionning: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#index-versioning