https://www.liangzl.com/get-article-detail-160290.html
text不能聚合,解決辦法有兩種:
或者採用下面辦法:
"fielddata": true
查看某個索引表結構
GET my_index/_mapping
檢索出所有的索引
GET _cat/indices
PUT my_index8
{
"mappings": {
"doc": {
"properties": {
"address": {
"type": "text"
},
"age": {
"type": "keyword"
},
"phone": {
"type": "text",
"index": false
}
}
}
}
}
上面的意思是:
建一個index爲my_index8,type爲doc 的結構
address字段 :全文檢索
age字段 :關鍵詞檢索,整個age字段內容作爲一個整體進行檢索
phone字段 :不建立索引,當然就不能用於檢索
插入一條數據
PUT my_index8/doc/2
{
"address": " 付 付店",
"age": "天天",
"phone": "136"
}
試圖通過phone字段檢索
如果不建立表結構,直接通過下面插入數據
PUT test_index/doc/1
{
"referre": "-",
"response_code": "200",
"remote_ip": "172.0.0.1",
"method": "POST",
"username": "-",
"http_version": "1.1",
"body_sent": {
"bytes": "0"
},
"url": "/helloworld"
}
FR:徐海濤(hunk Xu)
QQ技術交流羣:386476712