window下elasticsearch使用curl出现unmatched brace/bracket in column1

window下elasticsearch使用curl,来建立索引:

curl -XPUT "http://localhost:9200/my_index" -d "
{"settings":{"number_of_shards":3,
"number_of_replicas": 1},
"mappings": {"employee": {"properties":
{"first_name": { "type": "string"}, "last_name":
{"type": "string"}, "age": {"type": "integer"},"about":
{"type": "string"}, "interests": {"type": "string" },
"join_time": {"type": "date",
"format": "dateOptionalTime",  "index":"not_analyzed"} }}}}"

运行出现错误:

window下elasticsearch使用curl出现unmatched brace/bracket in column1_第1张图片

参考博客http://blog.csdn.net/long243416336/article/details/50486883,说是把引号变成三个引号

curl -XPUT "http://localhost:9200/my_index" -d "{"""settings""":{"""number_of_shards""":3,
"""number_of_replicas""": 1},"""mappings""": {"""employee""": {"""properties""": {"""first_name""": { """type""": """string"""}, """last_name""": {"""type""": """string"""}, """age""": {"""type""": """integer"""}, """about""": {"""type""": """string"""}, """interests""": {"""type""": """string""" }, """join_time""": {"""type""": """date""", """format""": """dateOptionalTime""",  """index""": """not_analyzed"""} }}}}"  


运行成功!!1

window下elasticsearch使用curl出现unmatched brace/bracket in column1_第2张图片


还有一点是在建索引之前不要建一个已经存在的索引名字,不然会出错

window下elasticsearch使用curl出现unmatched brace/bracket in column1_第3张图片


你可能感兴趣的:(window下elasticsearch使用curl出现unmatched brace/bracket in column1)