Elasticsearch - 删除 GrayLog2 中的旧源
Elasticsearch - Remove old source in GrayLog2
首先我不得不说我是 curl 的新手所以我在这里问
我在 GrayLog2 中有一些资源:
http://i.stack.imgur.com/xkelZ.jpg
并希望将它们全部删除
使用 curl 删除了“12:00:02:”来源
curl -XDELETE 'http://127.0.0.1:9200/graylog2_*/message/_query' -d ' {"query_string" : { "default_field" : "host", "query" : "12:00:02:" } }'
但是失败了
{"_indices":{"graylog2_0":{"_shards":{"total":1,"successful":0,"failed":1,"failures":[{"index":"graylog2_0","shard":0,"reason":"QueryParsingException[[graylog2_0] request does not support [query_string]]"}]}}}}
任何人都可以帮助我使用正确的 curl 命令吗?
您只是缺少第一个 query
关键字。将您的查询更改为此
curl -XDELETE 'http://127.0.0.1:9200/graylog2_*/message/_query' -d ' {"query": {"query_string" : { "default_field" : "host", "query" : "12:00:02:" } } }'
^
|
this was missing
您也可以使用这个等效查询
curl -XDELETE 'http://127.0.0.1:9200/graylog2_*/message/_query?q=host:"12:00:02:"'
但是如果你想全部删除它们你也可以使用这个查询
curl -XDELETE 'http://127.0.0.1:9200/graylog2_*/message/_query?q=host:*'
首先我不得不说我是 curl 的新手所以我在这里问
我在 GrayLog2 中有一些资源: http://i.stack.imgur.com/xkelZ.jpg
并希望将它们全部删除
使用 curl 删除了“12:00:02:”来源
curl -XDELETE 'http://127.0.0.1:9200/graylog2_*/message/_query' -d ' {"query_string" : { "default_field" : "host", "query" : "12:00:02:" } }'
但是失败了
{"_indices":{"graylog2_0":{"_shards":{"total":1,"successful":0,"failed":1,"failures":[{"index":"graylog2_0","shard":0,"reason":"QueryParsingException[[graylog2_0] request does not support [query_string]]"}]}}}}
任何人都可以帮助我使用正确的 curl 命令吗?
您只是缺少第一个 query
关键字。将您的查询更改为此
curl -XDELETE 'http://127.0.0.1:9200/graylog2_*/message/_query' -d ' {"query": {"query_string" : { "default_field" : "host", "query" : "12:00:02:" } } }'
^
|
this was missing
您也可以使用这个等效查询
curl -XDELETE 'http://127.0.0.1:9200/graylog2_*/message/_query?q=host:"12:00:02:"'
但是如果你想全部删除它们你也可以使用这个查询
curl -XDELETE 'http://127.0.0.1:9200/graylog2_*/message/_query?q=host:*'