1
例如,我試圖在elasticsearch 5.1中構建查詢 - 給我所有作者在預定義作者列表中的書籍。使用單筆者在工作時,而是傳遞一個數組的時候 - 我沒有得到任何結果Elasticsearch - 搜索數組中的值的一部分的記錄
let query = JSON.stringify({
"size": 10000,
"query": {
"bool": {
"must": [{
"term": {
"recordtype": "Book"
}
},
{
"term": {
"recordLocation": "library"
}
}
],
"filter": {
"term": {
"author": authors
}
}
}
}
});
其中作者們let authors = ['a', 'b', 'c', 'd']
什麼我錯過?
替換項查詢的條款查詢如下圖所示' 「術語」:{ 「作者」:作者 }'和' 「術語」:{ 「作者」:['a','b','c','d'] }' – avr
謝謝 - 它解決了它 –
很高興!它幫助你:) – avr