Loading

创建es索引-格式化和非格式化

创建es索引-格式化和非格式化

学习了:https://www.imooc.com/video/15768

索引有结构化和非结构化的区分;

1, 先创建索引,然后POST修改mapping

首先创建索引,使用head插件中的创建索引界面进行创建;

然后POST http://localhost:9200/book/novel/_mappings

{
  "novel": {
    "properties": {
      "title": {
        "type": "text"
      }
    }
  }
}

 

2,直接PUT索引,同时带上mapping

PUT http://localhost:9200/people

{
    "settings":{
        "number_of_shards":3,
        "number_of_replicas":1
    },
    "mappings":{
        "man":{
            "properties":{
                "name":{
                    "type":"text"
                },
                "country":{
                    "type":"keyword"
                },
                "date":{
                    "type":"date",
                    "format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
                }
            }
        },
        "woman":{}
    }
}

 

posted @ 2018-05-01 16:38  stono  阅读(257)  评论(0)    收藏  举报