无法在Elasticsearch中完全创建索引

时间:2019-03-06 15:47:14

标签: elasticsearch curl put

我是Elasticsearch的新手,很抱歉,这是一个新手问题:-)

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

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的快照(我将其切成一半是因为没有空间):

Snapshot 1 of terminal

快照2:

Snapshot2

我最困惑的原因是:

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

谢谢。

1 个答案:

答案 0 :(得分:0)

Windows上正确的curl命令如下:

staffList