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"

          }

        }

      }

  }

}

發佈了36 篇原創文章 · 獲贊 37 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章