您需要使用Put Mapping AP I 定义映射。
curl -XPUT 'http://localhost:9200/twitter/_doc/_mapping' -H 'Content-Type: application/json' -d '{ "_doc" : { "properties" : { "message" : {"type" : "text", "store" : true} } }}'日期可以定义如下:
curl -XPUT 'http://localhost:9200/twitter/_doc/_mapping' -H 'Content-Type: application/json' -d '{ "_doc" : { "properties" : { "user" : {"type" : "keyword", "null_value" : "na"}, "message" : {"type" : "text"}, "postDate" : {"type" : "date"}, "priority" : {"type" : "integer"}, "rank" : {"type" : "float"} } }}'


