[英]sorting nested documents in elastic search
我在彈性搜索文檔中有2個字段的嵌套字段:
blog = Nested(
properties={
'id': Integer(),
'rating': Integer()
}
)
ES文檔包含博客列表:blog1,blog2等。
我希望所有文件的blob.id = x並在對應於該blob的評級字段上排序。 在沒有排名腳本的情況下使用彈性搜索查詢執行此操作是否可行? 請指教。
這樣的事情應該可以滿足您的需求:
{
"query": {
"nested": {
"path": "blog",
"query": {
"term": {
"blog.id": 123
}
}
}
},
"sort": [
{
"blog.rating": {
"order": "asc",
"nested_path": "blog",
"nested_filter": {
"term": {
"blog.id": 123
}
}
}
}
]
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.