使用curl在elasticsearch上添加映射

时间:2016-03-06 11:33:55

标签: elasticsearch

您好我正在尝试添加elasticsearch mapping但我正面临异常

  

{"错误":" InvalidTypeNameException [映射类型名称[映射]可以&#t; t   从' ']"," status":400}开始

我使用的是0.99.10版本的elasticSearchIndex。

curl -XPUT 'http://localhost:9200/twitter/_mapping/tweet' -d '{"tweet" : {"properties" : {"message" : {"type" : "string", "store" : true }}}}'

1 个答案:

答案 0 :(得分:0)

当您在网址中包含文档类型时,您应该通过 properties 字段启动有效负载,如下所示:

curl -XPUT 'http://localhost:9200/twitter/_mapping/tweet' -d '{"properties" : {"message" : {"type" : "string", "store" : true }}}'

如上所述here