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