您的位置:首页 > 其它

Elasticsearch 2.3.2 创建index及type

2016-06-16 10:53 239 查看

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   同时创建index及type

{

    "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