简体   繁体   中英

Unable to fully create index in elasticsearch

I am new to elasticsearch so sorry is this is a newbie question :-)

I have read the documentation,and I'm trying to create an index.

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

But i get this:

{"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:
}
 ^

If i run curl -X GET -x "" "http://127.0.0.1:9200"/test

I get:

{"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"}}}}

Snapshot(of terminal 1(I cut it to half because there was no sapce):

终端快照1

Snapshot2:

Snapshot2

I am mostly confused because:

  • It acknowledges:true then suddenly stops interpreting the code
  • All the braces are properly matched,so I don't understand why it says unmatched brace

Thanks.

Windows上正确的curl命令如下:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM