0
好的,這裏是我的問題: 在後端我有java spring引導,用mongodb和elasticsearch。 我在elasticsearch結構是這樣的文件:elasticsearch嵌套對象數組 - 複雜查詢
{ "id": 1,
"prefixes": [
{
"prefName": "RS",
"value": "c"
},
{
"prefName": "99c",
"value": "c"
},
{
"prefName": "RT",
"value": "a"
},
{
"prefName": "001b",
"value": "a"
},
{
"prefName": "DT",
"value": "m"
},
{
"prefName": "001c",
"value": "m"
},
{
"prefName": "001d",
"value": "b"
},
{
"prefName": "RN",
"value": "16"
},
{
"prefName": "001e",
"value": "16"
},
{
"prefName": "BN",
"value": "2-228-32590-2"
},
{
"prefName": "010a",
"value": "2-228-32590-2"
},
{
"prefName": "SS",
"value": "d"
},
{
"prefName": "100b",
"value": "d"
},
{
"prefName": "PY",
"value": "1975"
},
{
"prefName": "100c",
"value": "1975"
},
{
"prefName": "LA",
"value": "fre"
},
{
"prefName": "101a",
"value": "fre"
},
{
"prefName": "CO",
"value": "fra"
},
{
"prefName": "102a",
"value": "fra"
},
{
"prefName": "KW",
"value": "Ekole et psychologie individuelle comparee"
}] }
從客戶端應用程序,我傳遞的對象與結構:
{
"pref1": "(prefixName - value)",
"pref2": "(prefixName - value)",
"pref3": "(prefixName - value)",
"pref4": "(prefixName - value)",
"pref5": "(prefixName - value)",
"text1": "(prefix value - value)",
"text2": "(prefix value - value)",
"text3": "(prefix value - value)",
"text4": "(prefix value - value)",
"text5": "(prefix value - value)",
"operator1": "(logical OR,AND,NOT)",
"operator2": "(logical OR,AND,NOT)",
"operator3": "(logical OR,AND,NOT)",
"operator4": "(logical OR,AND,NOT)"
}
所以,我有5個可選的前綴來選擇(PREF1,PREF2 ...例如RS,RT ..), 文本字段是它們的值,應該用短語前綴進行匹配。問題是我有4個邏輯運算符鏈接這些查詢。有人可以指導我如何構建足夠的彈性搜索查詢來滿足這些需求。
以及我仍然沒有得到什麼是這些邏輯運算符以及如何與前綴值結合。你能舉一些例子,你累到目前爲止這個 – user3775217
我已經發布img的搜索形式和解釋什麼查詢應該做的:) – deadf00d