私はES 2.2.0を持っていて、試しています
curl -XPOST "http://localhost:9200" -d @jnk.json
しかし、私は得る
Warning: Couldn't read data from file "jnk.json", this makes an empty POST.
No handler found for uri [/] and method [POST]
ここにファイル jnk.json の内容があります
PUT junktest
{
"mappings": {
"test": {"properties": {
"DocumentID": {
"type": "string"
},
"Tags":{
"type" : "string",
"index" : "not_analyzed"
},
"Summary": {
"type": "string",
"index" : "not_analyzed"
},
"Status": {
"type": "string",
"index" : "not_analyzed"
},
"Location": {
"type": "string",
"index" : "not_analyzed"
},
"Error": {
"type": "string",
"index" : "not_analyzed"
},
"Author": {
"type": "string",
"index" : "not_analyzed"
},
"Sector": {
"type": "string",
"index" : "not_analyzed"
}
"Created Date": {
"type": "date",
"format": "yyyy-MM-dd"
}
}
}
}
}
POST /junktest/test/
{
"DocumentID":"555661",
"Tags":["A","B","C","D"],
"Summary":"Summary Text",
"Status":"Review",
"Location":"HDFS",
"Error":"None",
"Author":"Poi KLj",
"Sector":"Energy",
"Created Date":"2013-04-23"
}
POST /junktest/test/
{
"DocumentID":"555662",
"Tags":["B","C","D"],
"Summary":"Summary Text",
"Status":"Review",
"Location":"HDFS",
"Error":"None",
"Author":"Abc Mnb",
"Sector":"Energy",
"Created Date":"2013-05-23"
}
そのため、マッピングを作成してから、単一のドキュメントを投稿しています。私は何を間違っていますか?
同じ結果が得られます-XPUT
編集
どうもありがとう@Bahaaldine Azarmi!不足しているコンマがあり、マッピングを個別に作成できました:)しかし、私はバルクコマンドを次のように試しました
curl -XPOST "http://localhost:9200/_bulk" --data-binary @post.json
APIによると、エラーが発生しました
{"error":{"root_cause":[{"type":"json_parse_exception","reason":"Unexpected char
acter (':' (code 58)): expected a valid value (number, String, array, object, 't
rue', 'false' or 'null')\n at [Source: [B@2f1a62ab; line: 1, column: 27]"}],"typ
e":"json_parse_exception","reason":"Unexpected character (':' (code 58)): expect
ed a valid value (number, String, array, object, 'true', 'false' or 'null')\n at
[Source: [B@2f1a62ab; line: 1, column: 27]"},"status":500}
ここに私のpost.jsonがあります
{ "index" : { "_index" : "junktest", "_type" : "test"} }
{
"DocumentID":"555661",
"Tags":["A","B","C","D"],
"Summary":"Summary Text",
"Status":"Review",
"Location":"HDFS",
"Error":"None",
"Author":"Poi KLj",
"Sector":"Energy",
"Created Date":"2013-04-23"
}
私の構文に何か問題がありますか?場違い:
なキャラは?
修理済み
これらは区切り文字として扱われるため、バルク API では改行は許可されません。したがって、ファイルの正しい形式は
{"index":{"_index":"junktest","_type":"test"}}
{"DocumentID":"555661","Tags":["A","B","C","D"],"Summary":"Summary Text","Status":"Review","Location":"HDFS","Error":"None","Author":"Poi KLj","Sector":"Energy","Created Date":"2013-04-23"}
入力ファイルは改行で終了する必要があります