The requested URL was not found on this server. 不管你信不信,反正我是没找到

找出有两个号码以上的人-查询语法如何写?

Elasticsearch | 作者 Jack_Xiong | 发布于2018年06月20日 | 阅读数:866

以下脚本是目前es库中存的数据,其中phones为集合,现需要找出大于两个号码以上的人员,现请教各位大神如何写这个数组大小的查询语法?{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": "test",
"_type": "mytype",
"_id": "2",
"_score": 1,
"_source": {
"xm": "刘星星",
"phones": [
{
"phone_type": "住宅电话",
"phone_number": "0756-3333333"
},
{
"phone_type": "移动电话",
"phone_number": "13431240077"
}
]
}
},
{
"_index": "test",
"_type": "mytype",
"_id": "1",
"_score": 1,
"_source": {
"xm": "张三三",
"phones": {
"phone_type": "住宅电话",
"phone_number": "13431240077"
}
}
}
]
}
}
已邀请:

laoyang360 - Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net

赞同来自: zyb1994111

举例如下:


POST test_index/test_type/_search
{
"query":
{
"constant_score" : {
"filter" : {
"script" : {
"script" : "doc['array.keyword'].values.length > 4"
}
}
}
}
}

要回复问题请先登录注册