-
Notifications
You must be signed in to change notification settings - Fork 802
Results returns 10, records returns 62000 #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm getting a similar thing using es-rails with Mongoid. Also, my indexes don't seem to be searchable at all. |
Yeah, it's not working properly? :S |
same here :( |
I'm not using mongoid, and getting this problem. Hopefully it's fixed ASAP On Friday, August 22, 2014, Pavel Kotlyar [email protected] wrote:
Mohamed El Mahallawy @mmahalwy4167101981 |
Please post the code you're using, and try to emulate the behaviour in integration tests, eg. https://github.com/elasticsearch/elasticsearch-rails/blob/master/elasticsearch-model/test/integration/active_record_basic_test.rb#L139-L141 |
It's the same thing as #215 @topics = Topic.search(params[:q]).records.records.where(user: current_user).page(params[:page]).per(10) and in my model
But I'm in doubt that it is right thing to do. @karmi what is the right way? |
@onemanstartup I still don't understand the problem from the incomplete code examples and descriptions in this ticket :) |
def self.search(query, options={})
__set_filters = lambda do |key, f|
@search_definition[:filter][:and] ||= []
@search_definition[:filter][:and] |= [f]
end
@search_definition = {
query: {},
filter: {},
}
unless query.blank?
@search_definition[:query] = {
bool: {
should: [
{ multi_match: {
query: query,
fields: ['title^10', 'body'],
operator: 'and',
analyzer: 'russian_morphology_custom'
}
}
]
}
}
@search_definition[:sort] = { updated_at: 'desc' }
# Without that parameter default is 10
@search_definition[:size] = 100
else
@search_definition[:query] = { match_all: {} }
@search_definition[:sort] = { updated_at: 'desc' }
end
__elasticsearch__.search(@search_definition)
end If i want to query for item that belongs to user through active_record relations I need all items and then apply paging. But in this situation records returns only 10 items. It is not obvious why. Sorry for my stupidity :) |
By default, ES will always return just 10 results, that's expected. Use the
Why don't you search on this field, that way you limit the search only for results for
Yes, always :) |
Any news here? I don't see the problem. |
@karmi see my other issue. Commented on it! |
Got the same issue, my problem is that I was expecting all the macthing results to be returned. However from the documentation, it looks like this is the default behavior of ES. I suppose that should be written somewhere in the README as one would expect it's database/ORM/whatever to return all the matchings. |
.results
returns 10, I can change the size, but when I change it to 50, it returns 20.When I do
.records
it returns 62000, which is the correct number.Don't know what methods to use with results to output even more than 50!
The text was updated successfully, but these errors were encountered: