我想从ElasticSearch中删除数据。我已经删除了索引。然而,这似乎并没有真正删除数据本身。我看到的其他东西指向通过查询删除功能。然而,我甚至不知道该问什么。我知道指数。本质上,我想知道如何做a

DELETE FROM [Index]

从邮递员在Chrome。然而,我没有任何运气。似乎无论我做什么,数据都不会消失。到目前为止,我已经成功地删除索引使用DELETE HTTP动词在邮差和使用一个url:

   http://localhost:9200/[indexName]

然而,这似乎并没有真正删除数据(又名文档)本身。


当前回答

假设我需要删除索引filebeat-7.6.2-2020.04.30-000001,我使用curl delete选项执行它(curl -X delete "localhost:9200/filebeat-7.6.2-2020.04.30-000001?pretty"),并导致如下所示的身份验证问题;

{
  "error" : {
    "type" : "security_exception",
    "reason" : "missing authentication credentials for REST request [/filebeat-7.6.2-2020.04.30-000001?pretty]"
  },
  "status" : 401
}

在这里,您应该使用为Elasticsearch提供的用户名和密码对curl请求进行身份验证。然后试着

curl -X DELETE -u myelasticuser:myelasticpassword "localhost:9200/filebeat-7.6.2-2020.04.30-000001?漂亮”

将导致{ “acknowledge”:正确 }。

其他回答

你必须发送一个DELETE请求到

http://[your_host]:9200/[your_index_name_here]

你也可以删除单个文档:

http://[your_host]:9200/[your_index_name_here]/[your_type_here]/[your_doc_id]

我建议你用橡皮筋。

删除后,您可以使用以下URL查看索引是否仍然存在:http://[your_host]:9200/_stats/

好运!

最简单的方法!

Endpoint :
http://localhost:9201/twitter/_delete_by_query

Payload :
{
  "query": { 
    "match": {
      "message": "some message"
    }
  }
}

在弹性搜索中,twitter在哪里是索引

裁判;https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html

您可以删除整个索引,文档类型或一个特定的id数据。 这是三种方法:

curl -XDELETE localhost:9200/index_name curl -XDELETE localhost:9200/index_name/doc-type curl -XDELETE localhost:9200/index_name/doc-type/ documententid

如果你想删除所有索引,那么使用通配符。

我正在使用Kibana作为查看和搜索弹性搜索数据的工具,基于良好的用户体验,我推荐它。

以下查询将有助于从弹性搜索中删除数据

情况1:如果你知道数据行的id:

DELETE /index_name/_doc/{id}

案例2:根据列值进行删除: 假设我有一个名为abc的列。

现在我必须得到_id字段基于column_name最终删除该行。

GET /uts_checkout_configurations/_search { "query" : { "constant_score" : { "filter" : { "bool": { "must": {"exists": {"field": "ABC"}} } } } } }

最后,您将获得_id作为其中一个字段的数据。

根据-删除

DELETE /index_name/_doc/{_id}

在python中可以这样删除索引

from elasticsearch import Elasticsearch

es = Elasticsearch([{'host':'localhost', 'port':'9200'}])

es.index(index='grades',doc_type='ist_samester',id=1,body={
    "Name":"Programming Fundamentals",
    "Grade":"A"
})

es.indices.delete(index='grades')