gpt4 book ai didi

elasticsearch - 是否可以使用Kibana生成的查询从Elasticsearch中删除?

转载 作者:行者123 更新时间:2023-12-02 22:52:18 25 4
gpt4 key购买 nike

我不小心从Logstash加载了一些数据到Elasticsearch中。

基本上,我忘了在Logstash配置中包括start_position => "beginning",因此,如果删除.sincedb_*并重新运行,我将有一小部分数据被重复。

我使用Kibana来查看此数据,然后单击“检查”按钮以查看其运行的查询:

curl -XGET 'http://els-server:9200/logstash-2014.02.19,logstash-2014.02.18/_search?pretty' -d '{
"facets": {
"0": {
"date_histogram": {
"field": "@timestamp",
"interval": "10m"
},
"facet_filter": {
"fquery": {
"query": {
"filtered": {
"query": {
"query_string": {
"query": "tags:\"a-tag-that-uniquely-matches-the-mistake\""
}
},
"filter": {
"bool": {
"must": [
{
"match_all": {}
},
{
"range": {
"@timestamp": {
"from": 1392723206360,
"to": "now"
}
}
},
{
"bool": {
"must": [
{
"match_all": {}
}
]
}
}
]
}
}
}
}
}
}
}
},
"size": 0
}'

如果我在ELS服务器上运行此命令,它将找到相同的结果集(按预期):
{
"took" : 23,
"timed_out" : false,
"_shards" : {
"total" : 10,
"successful" : 10,
"failed" : 0
},
"hits" : {
"total" : 558829,
"max_score" : 0.0,
"hits" : [ ]
},
"facets" : {
"0" : {
"_type" : "date_histogram",
"entries" : [ {
"time" : 1392799200000,
"count" : 91
} ]
}
}
}
"count" : 91行与Kibana中显示的事件数相同。

如何将其变成DELETE操作以删除这91个条目?

谢谢,
KB

最佳答案

我相信您可以在1.0或更高版本中通过查询删除。

Click here for ES doco on that API

我使用Chrome plugin Sense对ES手动运行查询。

例:

DELETE /twitter/tweet/_query
{
"query" : {
"term" : { "user" : "kimchy" }
}
}

就您而言,您应该只使用查询的查询部分:
DELETE /twitter/_search
{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "tags:\"a-tag-that-uniquely-matches-the-mistake\""
}
},
"filter": {
"bool": {
"must": [
{
"match_all": {}
},
{
"range": {
"@timestamp": {
"from": 1392723206360,
"to": "now"
}
}
},
{
"bool": {
"must": [
{
"match_all": {}
}
]
}
}
]
}
}
}
}
}

关于elasticsearch - 是否可以使用Kibana生成的查询从Elasticsearch中删除?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21879439/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com