elasticsearch 索引 mapping一起创建
创建索引,创建mapping可以分开创建,但有的时候,我们是需要一起创建。
MacBook-Pro:question_api zhangying$ curl -XPUT "http://localhost:9200/tank1/?pretty" -H "Content-Type: application/json" -d' > { > "mappings" : { > "test": { > "_all":{ > "enabled":false > }, > "properties": { > "id": { > "type": "integer" > }, > "username": { > "type": "text", > "analyzer": "ik_pinyin_analyzer" > }, > "description": { > "type": "text", > "analyzer": "ik_pinyin_analyzer" > } > } > } > }, > "settings" : { > "analysis": { > "analyzer": { > "ik_pinyin_analyzer": { > "type": "custom", > "tokenizer": "ik_max_word", > "filter": ["my_pinyin", "word_delimiter"] > } > }, > "filter": { > "my_pinyin": { > "type": "pinyin" > } > } > } , > "number_of_shards" : "5", > "number_of_replicas" : "0" > } > }' { "acknowledged" : true, "shards_acknowledged" : true, "index" : "tank1" }