Skip to content
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

Size Parameter Return Issue #20

Closed
KKsharma99 opened this issue Jun 6, 2019 · 4 comments
Closed

Size Parameter Return Issue #20

KKsharma99 opened this issue Jun 6, 2019 · 4 comments
Assignees

Comments

@KKsharma99
Copy link
Contributor

How can I run a query on a QA to get only the answers that satisfy the query but are not limited to 10?

Currently the results are limited to 10. If you set the size parameter of the QA query function to the max number of objects in the json and then run the query you will get all entries in the json not solely the ones that satisfy the query.

Context (Example): I have Question Answerer loaded with a json of 300 employees, 152 of which are Male. I want to run a query that returns me all 152 Males.

If I run the following I get 10 results:
s = qa.build_search(index='user_data_3')
s.query(sex='Male').execute()

So I set the size to the max number of employees, 300 but now I get 300 results, not a truncated 152 results that satisfy the query:
s = qa.build_search(index='user_data_3')
s.query(sex='Male', size=300).execute()

@KKsharma99
Copy link
Contributor Author

An update to the above, I meant to write qa.get() function instead of the qa.query()

@KKsharma99
Copy link
Contributor Author

When working with the query() function, even if you pass in a size greater than 10, only 10 results will be returned.

Ex: Only returns 10 results
s = qa.build_search(index='user_data_3')
s.query(sex='Male', size=300).execute()

@minhtuev
Copy link
Contributor

minhtuev commented Jun 7, 2019

@KKsharma99 : you should do: s.query(sex='Male').execute(size=300)

@ritvikshrivastava
Copy link
Contributor

The size function is working with .filter(), but not with .query(). Passing the parameters inside the filter solves this issue and gives only the required responses. That suffices for the current use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants