1
我有這種數據結構的ElasticSearch如何通過2級嵌套項目進行搜索?
[
{
id:1,
translations: [
{
language: {id:1; name: "English"},
value: "How are you ?"
},
{
language: {id:2; name: "French"},
value: "Comment allez-vous ?"
},
...
]
},
...
]
所以現在我想使這將是查的單詞只有英文翻譯,而不是在法國或另一個查詢。如果用戶輸入「Comment allez-vous」,他將不會看到任何結果。
,這裏是config.yml
index_name: %es.index_name%
types:
vocabularyItem:
mappings:
translations:
type: "nested"
properties:
value: {boost: 5}
definition: {boost: 2}
alternativeTranslations:
type: "nested"
properties:
value: ~
language:
type: "nested"
properties:
id:
type : integer
persistence:
driver: orm
model: Bundle\Model\VocabularyItem
provider:
batch_size: 100
listener:
immediate: ~
finder: ~
你好Hayk,你可以在「for_elastica:」下面顯示你的yaml映射配置嗎? – Elyass
你好@Elyass,剛更新了帖子。請看看 –
謝謝。請查看嵌套查詢https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html,我將爲您的問題準備一個答案 – Elyass