Невозможно полностью создать индекс вasticsearch - PullRequest
0 голосов
/ 06 марта 2019

Я новичок вasticsearch, так что извините, это вопрос новичка: -)

Я прочитал документацию и пытаюсь создать индекс.

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 (я сократил его до половины, потому чтоsapce не было):

Snapshot 1 of terminal

Снимок2:

Snapshot2

Я в основном растерян, потому что:

  • Это acknowledges:true, а затем внезапно перестает интерпретировать код
  • Все скобки правильно сопоставлены, поэтому я не понимаю, почему он говорит unmatched brace

Спасибо.

1 Ответ

0 голосов
/ 06 марта 2019

Правильная команда curl в Windows следующая:

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