我在应用程序的某些部分使用了elasticsearch,由于某种原因,我的某些用户会收到重复的条目。
这是搜索:
def newest_messages_for_user_by_elasticsearch(user)
filter_conditions = {
must: {term: {state: 'accepted'}},
must_not: [
{term: {"user_id" => user.id}}
]
}
self.search(
query: { match_all: {} },
filter: {bool: filter_conditions},
sort: [
{created_at: {order: :desc}}
]
)
end
有谁可以告诉我为什么它会返回重复的项目?
这两个请求看起来像这样:
GET http://localhost:9200/development_messages/message/_search?from=0&size=20 [status:200, request:0.002s, query:0.001s]
GET http://localhost:9200/development_messages/message/_search?from=20&size=20 [status:200, request:0.008s, query:0.002s]
谢谢!