elasticsearch 索引 mapping一起创建

张映 发表于 2018-05-19

分类目录: 服务器相关

标签:, ,

创建索引,创建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"
}

 



转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/server/1920.html

留下评论

留下评论
  • (必需)
  • (必需) (will not be published)
  • (必需)   8X1=?