Remove a field from a Elasticsearch document

后端 未结 5 1101
长情又很酷
长情又很酷 2020-12-02 13:00

I need to remove a field in all the documents indexed to Elasticsearch . How can i do it. Will any of the delete queries help me achieve this.

5条回答
  •  半阙折子戏
    2020-12-02 13:45

    The previous answers doesn't worked for me.

    I had to add the keyword "inline":

    POST /my_index/_update_by_query
    {
      "script": {
        "inline": "ctx._source.remove(\"myfield\")"
      },
      "query" : {
          "exists": { "field": "myfield" }
      }
    }
    

提交回复
热议问题