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

Count returns 0 and does not check for failed shards #1302

Open
yogevyuval opened this issue Jan 23, 2020 · 1 comment
Open

Count returns 0 and does not check for failed shards #1302

yogevyuval opened this issue Jan 23, 2020 · 1 comment
Labels
Category: Bug Something isn't right Priority: Low

Comments

@yogevyuval
Copy link

yogevyuval commented Jan 23, 2020

When performing count with an illegal query (too many clauses, invalid regex, etc'), the error is hidden from the user and the return value is 0, which is wrong.

For example if we run an invalid query, with date range filtering on several indices, the result will include "successful" shards which are considered successful because the query didn't event ran on them because they not meet the date range criteria, and some failed shards for indices who did meet the range, but failed because of the query.

The response is not validated and there is no check for failed shards. Actually there is a 6-years old TODO that mentions that:

image

Here is an example response:

{'count': 0,
 '_shards': {'total': 12,
  'successful': 6,
  'skipped': 0,
  'failed': 6,
  'failures': [{'shard': 0,
    'index': 'my-index-2020-01-20',
    'node': 'fHCBfQdfaraIDaqOH-i2Ug',
    'reason': {'type': 'query_shard_exception',

and the return value will be 0.

This behaviour is confusing and unwanted, as you can search for important events and get '0' from the count, although there was just an error in the query.

@yogevyuval
Copy link
Author

yogevyuval commented Jan 28, 2020

@honzakral are you familiar with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug Something isn't right Priority: Low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants