我有这样的映射:
{
"post": {
"properties": {
"author_gender": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
},
"author_link": {
"type": "string",
"index": "no"
},
"content": {
"type": "string"
},
"mentions": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"profile_image_url": {
"type": "string"
},
"screen_name": {
"type": "string"
}
}
}
}
}
我需要按mentions
对象的大小进行搜索。我试过这个:
{
"filter": {
"script": {
"script": "doc['mentions'].values.length == 2"
}
}
}
这是行不通的。给出错误
嵌套:ElasticSearchIllegalArgumentException [No field found for [mentions] in mapping with types [post]];
我也尝试将脚本部分替换为doc['mentions.id'].value.length == 2
. 这也是错误的
嵌套:ArrayIndexOutOfBoundsException[10];
如何查询mentions
对象大小为 2 的记录?