通过运行以下命令验证映射是否已真正设置:
curl localhost:9200/my_index/_mapping?pretty=true
创建索引的命令似乎不正确。它不应包含
"index" : {为根元素。试试这个:curl -XPUT localhost:9200/my_index -d '{ "settings": { "number_of_shards": 5, "number_of_replicas": 2 }, "mappings": { "my_type": { "_all": { "enabled": false }, "_source": { "compressed": true }, "properties": { "my_field": { "type": "string", "index": "not_analyzed" } } } }}'


