仅供自己作学习笔记,详情请移步es官方文档
1.问题------windows的cmder使用
curl -XPUT http://172.16.150.149:29200/facebook -d {"setting":{ "index":{ "number_of_shards":3,"number_of_replicas":2}}}
报错:
{"error":{"root_cause":
[{"type":"parse_exception",
"reason":"failed to parse source for create index"}],
"type":"parse_exception",
"reason":"failed to parse source for create index",
"caused_by":{"type":"json_parse_exception",
"reason":"Unexpected end-of-input: expected close marker for OBJECT (from [Source: [B@14f7b2cb; line: 1, column: 1])\n
at [Source: [B@14f7b2cb; line: 1, column: 21]"}},"status":400}curl: (3) [globbing] unmatched brace in column 7
curl: (3) [globbing] unmatched close brace/bracket in column 40
解决:
windows下使用
-d "{}"
(双引号)
ps:检查json格式网页工具
2.问题------windows下的双引号值
curl -XPUT http://172.16.150.149:29200/facebook -d "{ "settings":
{"number_of_shards":1},
"mappings":{"type1":{"_source":{" enabled":false},
"preperties":{"field1":{""type"":""string"","index":"not_analyzed"}}}}}"
{"error":{"root_cause":[{"type":"parse_exception",
"reason":"failed to parse source for create index"}],
"type":"parse_exception",
"reason":"failed to parse source for create index",
"cau