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": { "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" } } } } } |