我正在開發一個使用彈性搜索的應用程序,並且在某些情況下,我想根據術語和語言環境進行搜索。我在本地主機上elasticsearch通配符搜索和運算符
http://localhost:9200/index/type/_search
測試這個和參數
query : {
wildcard : { "term" : "myterm*" }
},
filter : {
and : [
{
term : { "lang" : "en" }
},
{
term : { "translations.lang" : "tr" } //this is subdocument search
},
]
}
下面是一個例子文件:
{
"_index": "twitter",
"_type": "tweet",
"_id": "5084151d2c6e5d5b11000008",
"_score": null,
"_source": {
"lang": "en",
"term": "photograph",
"translations": [
{
"_id": "5084151d2c6e5d5b11000009",
"lang": "tr",
"translation": "fotoğraf",
"score": "0",
"createDate": "2012-10-21T15:30:37.994Z",
"author": "anonymous"
},
{
"_id": "50850346532b865c2000000a",
"lang": "tr",
"translation": "resim",
"score": "0",
"createDate": "2012-10-22T08:26:46.670Z",
"author": "anonymous"
}
],
"author": "anonymous",
"createDate": "2012-10-21T15:30:37.994Z"
}
}
我試圖獲得與輸入語言使用通配符條款(自動完成) 「en」,輸出語言「tr」。它正在獲得具有「myterm」的條款,但不適用於此操作。任何建議將事先
你能發表你的文件是什麼樣子的例子嗎? – javanna
我添加了一個文檔,謝謝 –