次のようなマッピングがあります。
{
"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 [タイプ [投稿] とのマッピングで [メンション] のフィールドが見つかりません];
また、スクリプト部分を に置き換えてみましたdoc['mentions.id'].value.length == 2
。こちらもエラー
ネスト: ArrayIndexOutOfBoundsException[10];
mentions
オブジェクトサイズ 2 のレコードをクエリする方法は?