【问题标题】:Error on delete from elasticsearch using curl command使用 curl 命令从 elasticsearch 中删除时出错
【发布时间】:2019-01-16 14:54:32
【问题描述】:

当我尝试从我的 elasticsearch 索引中删除文档时,它会引发以下错误:

{"ok":false,"message":"已删除集群。"}

我之前删除了这个索引,然后又重新创建了它。 我可以向它发送文件,它们也反映在 kibana 上。但我就是无法删除文档或通过 curl 进行搜索查询。

是什么

【问题讨论】:

  • 你可能需要显示你正在运行的 curl 命令
  • curl -X DELETE "localhost:9200/charts/logs/_doc/L04dU2gBnyB5Q6tBoTIw" 这是 curl 命令。
  • 这一项也不起作用: curl -X GET "localhost:9200/charts/_search" -H 'Content-Type: application/json' -d' { "query": { "bool" : { "must_not": { "exists": { "field": "price" } } } } } '

标签: elasticsearch


【解决方案1】:

您的查询中有太多类型,logs_doc 需要删除:

curl -X DELETE "localhost:9200/charts/logs/_doc/L04dU2gBnyB5Q6tBoTIw"
                                        ^    ^
                                        |    |
                                  remove one of those

为了知道要删除哪一个,请检索您的索引映射并使用您可以在那里找到的一种映射类型名称。

curl -XGET localhost:9200/charts 

{
  "charts" : {
    "mappings" : {
      "doc" : {         <--- use the name you find here
      ...

【讨论】:

  • 即使运行这个命令也会给我同样的错误。是不是因为我之前删除了这个索引,然后又开始发送数据了。 {"ok":false,"message":"Deleted cluster."} 是在告诉我集群已被删除吗?因为如果我尝试使用它说已经存在的相同名称创建一个索引,我也在 kibana 上看到它。
  • 运行curl -XGET localhost:9200/_cat/health?v + curl -XGET localhost:9200/_cat/indices?v 时会得到什么(使用输出更新您的问题)
  • 是的。问题在于我发送网址的方式。
猜你喜欢
  • 1970-01-01
  • 2023-03-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-26
  • 1970-01-01
  • 2014-06-13
相关资源
最近更新 更多