猿问

删除超过一小时的文档在 elasticsearch 中不起作用

我是elasticsearch的新手,我在elasticsearch中有一个文档,文档包含大量用户视图,现在我想删除那些早于3小时的视图,为此我在elasticsearch中编写了以下查询


POST {INDEX}/_delete_by_query

{

  "query": {

    "bool": {

      "must": [

        {

          "term": {

            "type": "box_views"

          }

        },

        {

          "query": {

            "range": {

              "@created_at": {

                "gte": "now-3h"

              }

            }

          }

        }

      ]

    }

  }

}

当我执行此查询时,我收到以下错误


{ "error": { "root_cause": [ { "type": "parsing_exception", "reason": "no [query] 注册 [query]", "line": 1, "col": 66 } ], "type": "parsing_exception", "reason": "没有为 [query] 注册的 [query]", "line": 1, "col": 66 }, "status": 400 }


达令说
浏览 160回答 1
1回答

摇曳的蔷薇

我是elasticsearch的新手,我在elasticsearch中有一个文档,文档包含大量用户视图,现在我想删除那些早于3小时的视图,为此我在elasticsearch中编写了以下查询POST {INDEX}/_delete_by_query{  "query": {    "bool": {      "must": [        {          "term": {            "type": "box_views"          }        },        {          "query": {            "range": {              "@created_at": {                "gte": "now-3h"              }            }          }        }      ]    }  }}当我执行此查询时,我收到以下错误{ "error": { "root_cause": [ { "type": "parsing_exception", "reason": "no [query] 注册 [query]", "line": 1, "col": 66 } ], "type": "parsing_exception", "reason": "没有为 [query] 注册的 [query]", "line": 1, "col": 66 }, "status": 400 }
随时随地看视频慕课网APP
我要回答