Elasticsearch 2.3.2 创建index及type

1         创建索引及TYPE

1.1   创建索引

可在head中直接界面操作添加

 

         使用命令语句创建

        

{

    "settings": {

      "index": {

        "number_of_shards": 5,

        "number_of_replicas": 1

      }

  }

}

 

 

 

1.2   创建type

"analyzer": "ik" 中文分词

 

{

    "news": {

      "properties": {

        "content": {

          "analyzer": "ik",

          "type": "string"

        },

        "author": {

          "index": "not_analyzed",

          "type": "string"

        },

        "title": {

          "analyzer": "ik",

          "type": "string"

        },

        "category": {

          "index": "not_analyzed",

          "type": "string"

        },

        "publish_date": {

          "format": "yyyy/mm/dd",

          "type": "date"

        }

    }

  }

}

 

 

 

 

1.3   同时创建indextype

{

    "settings": {

      "index": {

        "number_of_replicas": "1",

        "number_of_shards": "5"

      }

    },

    "mappings": {

      "news": {

        "properties": {

          "content": {

            "analyzer": "ik",

            "type": "string"

          },

          "author": {

            "index": "not_analyzed",

            "type": "string"

          },

          "title": {

            "analyzer":   "ik",

            "boost": 5,

            "type": "string"

          },

          "category": {

            "index": "not_analyzed",

            "type": "string"

          },

          "publish_date": {

            "format": "yyyy/mm/dd",

            "type": "date"

          }

        }

      }

  }

}

你可能感兴趣的:(Elasticsearch)