Я новичок в elastisearch , поэтому извините, если это вопрос новичка.
По сути, я пытаюсь PUT
добавить некоторые данные в созданный мной индекс.
Я использую этот код (в командной строке):
curl -XPUT -x "" "http://127.0.0.1:9200/test/' -d '{"user" : "kimchy", "post_date" : "2009-11-15T14:12:12","message" : "trying"}
Но в командной строке я получаю эту ошибку:
[1/3]: http://127.0.0.1:9200/test/' -d 'user : kimchy --> <stdout>
--_curl_--http://127.0.0.1:9200/test/' -d 'user : kimchy
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"invalid v
ersion format: -D 'USER : KIMCHY HTTP/1.1"}],"type":"illegal_argument_exception
","reason":"invalid version format: -D 'USER : KIMCHY HTTP/1.1"},"status":400}
[2/3]: http://127.0.0.1:9200/test/' -d ' post_date : 2009-11-15T14:12:12 --> <s
tdout>
--_curl_--http://127.0.0.1:9200/test/' -d ' post_date : 2009-11-15T14:12:12
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"invalid v
ersion format: -D ' POST_DATE : 2009-11-15T14:12:12 HTTP/1.1"}],"type":"illegal
_argument_exception","reason":"invalid version format: -D ' POST_DATE : 2009-11-
15T14:12:12 HTTP/1.1"},"status":400}
[3/3]: http://127.0.0.1:9200/test/' -d 'message : trying --> <stdout>
--_curl_--http://127.0.0.1:9200/test/' -d 'message : trying
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"invalid v
ersion format: -D 'MESSAGE : TRYING HTTP/1.1"}],"type":"illegal_argument_except
ion","reason":"invalid version format: -D 'MESSAGE : TRYING HTTP/1.1"},"status"
:400}
Пожалуйста, помогитеЯ знаю, это так просто, но я просто не могу его найти.
Спасибо.
РЕДАКТИРОВАТЬ :
Когда я пытаюсь:
curl -H 'Content-Type: application/json' -XPUT 'http://127.0.0.1:9200/test/doc/1' -d '{"user" : "kimchy", "post_date" : "2009-11-15T14:12:12","message" : "trying"}'
Я получаю (в командной строке):
<code>*/
/* Page basics */
* {
font-family: verdana, sans-serif;
}
html body {
margin: 0;
padding: 0;
background: #efefef;
font-size: 12px;
color: #1e1e1e;
}
/* Page displayed title area */
#titles {
margin-left: 15px;
padding: 10px;
padding-left: 100px;
background: url('http://www.squid-cache.org/Artwork/SN.png') no-repeat l
eft;
}
/* initial title */
#titles h1 {
color: #000000;
}
#titles h2 {
color: #000000;
}
/* special event: FTP success page titles */
#titles ftpsuccess {
background-color:#00ff00;
width:100%;
}
/* Page displayed body content area */
#content {
padding: 10px;
background: #ffffff;
}
/* General text */
p {
}
/* error brief description */
#error p {
}
/* some data which may have caused the problem */
#data {
}
/* the error message received from the system or other software */
#sysmsg {
}
pre {
font-family:sans-serif;
}
/* special event: FTP / Gopher directory listing */
#dirmsg {
font-family: courier;
color: black;
font-size: 10pt;
}
#dirlisting {
margin-left: 2%;
margin-right: 2%;
}
#dirlisting tr.entry td.icon,td.filename,td.size,td.date {
border-bottom: groove;
}
#dirlisting td.size {
width: 50px;
text-align: right;
padding-right: 5px;
}
/* horizontal lines */
hr {
margin: 0;
}
/* page displayed footer area */
#footer {
font-size: 9px;
padding-left: 10px;
}
body
:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-ser
if; float: right; }
:lang(he) { direction: rtl; float: right; }
--></style>
</head><body>
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>
<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href
="http:///">http:///</a></p>
<blockquote id="error">
<p><b>Unable to determine IP address from host name <q></q></b></p>
</blockquote>
<p>The DNS server returned:</p>
<blockquote id="data">
<pre>Invalid hostname
Это означает, что кэш не смог разрешить имя хоста, представленное в URL.Проверьте правильность адреса.
Ваш администратор кеша вебмастер .
Сгенерировано пятница, 01 марта 2019 г. 15:50:22 GMT by asoju.unilag.edu.ng (squid / 3.1.6)
curl: (3) URL, использующий неверный / недопустимый формат или отсутствующий URL ОШИБКА: запрошенный URL не может быть получен