{ "took": 0, "timed_out": false, "_shards": { "total": 5, "successful": 5, "skipped": 0, "failed": 0 }, "hits": { "total": 3, "max_score": 0.2876821, "hits": [ { "_index": "product_index", "_type": "product", "_id": "1115", "_score": 0.2876821, "_source": { "isactive": true, "in_use": false, "brand_name": "Adidas", "sku_id": "56456487987987", "long_description": "this is long description", "key_feature": [ { "id": 1148, "key_feature": "sport wear" }, { "id": 1147, "key_feature": "Cotton shirt" }, { "id": 1146, "key_feature": "White and blue" } ], "isdeleted": false, "created_by": null, "brand_id": 5, "search_terms": [ { "label": "white shirt", "value": 9 } ] "color_id": 2, "specific_keywords": "", "item_list": [ { "item_id": 1114, "product_id": 1115, "isactive": true, "id": 9, "isdeleted": false }, { "item_id": 1113, "product_id": 1115, "isactive": true, "id": 10, "isdeleted": false } ],我的要求是附加所有相關(guān)文檔,其中包含特定的鍵值字段,這些字段是根據(jù)item_id在item_list中指定的。在上面的結(jié)果中,文檔 id 1115 具有item_list其中包含item_id 1114 和 1113。因此,特定字段附在文檔 1115 中。彈性搜索中的搜索查詢應(yīng)該是什么?
1 回答

慕碼人8056858
TA貢獻(xiàn)1803條經(jīng)驗(yàn) 獲得超6個(gè)贊
你不能加入彈性搜索,要實(shí)現(xiàn)你的目標(biāo),你可以做兩件事:
在item_id 1115中復(fù)制item_id 1114和1113的信息(當(dāng)然在所有其他文件中)。
請?jiān)趹?yīng)用程序級別加入,因此在此查詢之后,您可以提取item_id 1114 和 1113,并運(yùn)行其他兩個(gè)查詢以獲取有關(guān)此項(xiàng)的信息。然后在應(yīng)用程序級別加入所有 json。
添加回答
舉報(bào)
0/150
提交
取消