【问题标题】:Unable to fully create index in elasticsearch无法在弹性搜索中完全创建索引
【发布时间】:2019-03-06 15:47:13
【问题描述】:

我是弹性搜索的新手,很抱歉这是一个新手问题:-)

我已阅读文档,并且正在尝试创建索引。

curl -X PUT -x "" "http://127.0.0.1:9200"/test2 { "mappings": { "_doc": { "prope
rties": { "user" : { "type": "keyword" } } } } }

但我明白了:

{"acknowledged":true,"shards_acknowledged":true,"index":"test2"}curl: (3) unmatc
hed brace in URL position 1:
{
 ^
curl: (6) Could not resolve host: mappings
curl: (3) unmatched brace in URL position 1:
{
 ^
curl: (6) Could not resolve host: _doc
curl: (3) unmatched brace in URL position 1:
{
 ^
curl: (6) Could not resolve host: properties
curl: (3) unmatched brace in URL position 1:
{
 ^
curl: (6) Could not resolve host: user
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method PUT is not allowed for the URL /index.html.</p>
</body></html>
curl: (3) unmatched brace in URL position 1:
{
 ^
curl: (6) Could not resolve host: type
curl: (6) Could not resolve host: keyword
curl: (3) unmatched close brace/bracket in URL position 1:
}
 ^
curl: (3) unmatched close brace/bracket in URL position 1:
}
 ^
curl: (3) unmatched close brace/bracket in URL position 1:
}
 ^
curl: (3) unmatched close brace/bracket in URL position 1:
}
 ^
curl: (3) unmatched close brace/bracket in URL position 1:
}
 ^

如果我运行curl -X GET -x "" "http://127.0.0.1:9200"/test

我明白了:

{"test":{"aliases":{},"mappings":{},"settings":{"index":{"creation_date":"155119
5109041","number_of_shards":"5","number_of_replicas":"1","uuid":"WNIucwr0T8aniZk
PrVLoNA","version":{"created":"6060099"},"provided_name":"test"}}}}

快照(1号航站楼(我把它剪成一半,因为没有空间):

快照2:

我很困惑,因为:

  • acknowledges:true 然后突然停止解释代码
  • 所有大括号都正确匹配,所以我不明白为什么它说unmatched brace

谢谢。

【问题讨论】:

  • 再次查看双引号"http://127.0.0.1:9200"/test2。不好!

标签: elasticsearch curl put


【解决方案1】:

Windows 上正确的 curl 命令如下:

curl -X PUT "http://127.0.0.1:9200/test2" -d "{ \"mappings\": { \"_doc\": { \"properties\": { \"user\" : { \"type\": \"keyword\" } } } } }"

【讨论】:

  • 哦,嗨,val。还记得我吗?
  • 我觉得PUT后面应该有一个小的-x
  • The requested URL could not be retrieved 基本上和html代码
  • 你可以在你的问题中添加你的终端截图吗?
  • 那说明你的ES服务器没有启动,先验证一下
猜你喜欢
  • 1970-01-01
  • 2020-09-06
  • 1970-01-01
  • 2018-07-15
  • 2019-09-28
  • 2022-08-17
  • 2020-08-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多