Skip to content

How to use @CountQuery? #1915

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
emirUlken opened this issue Sep 1, 2021 · 9 comments
Closed

How to use @CountQuery? #1915

emirUlken opened this issue Sep 1, 2021 · 9 comments

Comments

@emirUlken
Copy link

I couldn't find any examples online. How do I extract count from this? Can I make the return type as List in my repo and get count at the same time?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 1, 2021
@emirUlken
Copy link
Author

Here is my query

@query("{"bool": {"must": [{"regexp": {"id": ".?0."}}, {"regexp": {"categoryname": ".?1."}}]}}")
List getFeedbacks(String id, String categoryName);

How do I get count from this query?

@emirUlken
Copy link
Author

I tried to get the size of the returning list but it's limited to 10 because of aggregation. I need the full count amount.

@sothawo
Copy link
Collaborator

sothawo commented Sep 1, 2021

@CountQuery("{"bool": {"must": [{"regexp": {"id": ".?0."}}, {"regexp": {"categoryname": ".?1."}}]}}")
Long getFeedbacks(String id, String categoryName);

what aggregation?

@sothawo sothawo added the status: waiting-for-feedback We need additional information before we can continue label Sep 1, 2021
@emirUlken
Copy link
Author

@CountQuery("{"bool": {"must": [{"regexp": {"id": ".?0."}}, {"regexp": {"categoryname": ".?1."}}]}}")
Long getFeedbacks(String id, String categoryName);

what aggregation?

Well idk if it's aggregation or not but the result size is always 10. It's like it has a limiter for the count. Is there any way I can get the result size for the correct total amount instead of 10?

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 1, 2021
@sothawo
Copy link
Collaborator

sothawo commented Sep 2, 2021

I just ran a test in a local program and a @CountQuery returns more than 10 there.

I found an issue with the execution of @Query method, this returns only the first 10 documents (Elasticsearch's default page size); that explains the list size of 10 you see. I created #1917 for this bug.

@sothawo sothawo added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Sep 2, 2021
@emirUlken
Copy link
Author

I just ran a test in a local program and a @CountQuery returns more than 10 there.

I found an issue with the execution of @Query method, this returns only the first 10 documents (Elasticsearch's default page size); that explains the list size of 10 you see. I created #1917 for this bug.

How did you put the annotation? Because when I replace @query with @CountQuery there, I get an error saying "No column found for type GetFeedbacks".

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 2, 2021
@sothawo
Copy link
Collaborator

sothawo commented Sep 2, 2021

    @CountQuery("{\"fuzzy\":{\"last-name\":\"?0\"}}")
    long countByLastNameFuzzy(final String lastName);

I just use @CountQuery instead of @Query and of course the return type of the method has to somethign a long value can be assigned to.

@sothawo sothawo added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Sep 2, 2021
@spring-projects-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Sep 9, 2021
@spring-projects-issues
Copy link

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Sep 16, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants