无法在教程

时间:2017-05-15 10:18:03

标签: elasticsearch

我从elasticsearch开始。在Sierra上我的Mac上安装了Elasticsearch和Kibana(没有错误)。现在我尝试使用本教程开始使用演示数据来探索ES:https://www.elastic.co/guide/en/kibana/current/tutorial-load-dataset.html 一切正常,但我有两个问题:

1)我收到了错误     PUT /logstash-2015.05.20 {...}

错误消息:

{
  "error": {
    "root_cause": [
      {
        "type": "index_already_exists_exception",

    "reason": "index [logstash-2015.05.20/1i-pAxzaTpWscYud0Ufczg] already exists",
    "index_uuid": "1i-pAxzaTpWscYud0Ufczg",
    "index": "logstash-2015.05.20"
  }
],
"type": "index_already_exists_exception",
"reason": "index [logstash-2015.05.20/1i-pAxzaTpWscYud0Ufczg] already exists",
"index_uuid": "1i-pAxzaTpWscYud0Ufczg",
"index": "logstash-2015.05.20"
  },
  "status": 400
}`

如果索引已经存在,我可以忽略此消息吗?所以一切都应该没问题?

2)即使在下一步我也遇到了错误:

curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary @accounts.json`

错误消息:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "child \"method\" fails because [\"method\" must be one of [HEAD, GET, POST, PUT, DELETE]]",
  "validation": {
    "source": "query",
    "keys": [
      "method"
    ]
  }
}

感谢您提供任何帮助或提示。

1 个答案:

答案 0 :(得分:0)

查看文件。它包含一行索引/映射和其他设置

{"index":{"_id":"1"}}

和文档本身的另一行:

{"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}

对于要使用_bulk api编制索引的每个文档,重复这两行。只是试着'放''索引中的一个文档

PUT localhost:9200/bank/account/1   
 {"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}

您熟悉Chrome的sense插件吗?它对弹性搜索开发非常有帮助: - )