悟空,拿我的打狗棒来

es开启_all字段,但是结果不是写入所有字段的内容值

Elasticsearch | 作者 xiao | 发布于2020年03月14日 | 阅读数:1558

ES版本 5.4.3 
 索引mapping如下:
开启了_all
{
"order": 1,
"template": "test*",
"settings": {
"index": {
"number_of_shards": "6",
"number_of_replicas": "1",
"refresh_interval": "1s"
}
},
"mappings": {
"test": {
"_all": {
"store": true,
"enabled": true
}
}
},
"aliases": {}
}

写入测试数据:
curl -XPOST 'http://ip:9200/test/test/1' -d '{
"title": "我是中国人",
"content": "热爱共产党"
}'

查询数据:
curl -XPOST 'http://ip:9200/test/_search' -d '{
"query": {
"match": {
"_all": "中国人"
}
},
"highlight": {
"fields": {
"_all": {}
}
}
}'

结果如下:
{
"took": 17,
"timed_out": false,
"_shards": {
"total": 6,
"successful": 6,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.854655,
"hits": [
{
"_index": "test",
"_type": "test",
"_id": "1",
"_score": 0.854655,
"_source": {
"title": "我是中国人",
"content": "热爱共产党"
},
"highlight": {
"_all": [
"我是<em>中</em><em>国</em><em>人</em>"
]
}
}
]
}
}
 
为什么数据只有title的内容写入_all,按道理不是应该title和content都写入_all字段吗
已邀请:

要回复问题请先登录注册