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

ES2.x Query DSL is not used in the /bin/check-es-query-count.rb script #35

Open
agastya71 opened this issue Mar 16, 2016 · 1 comment
Open

Comments

@agastya71
Copy link

I tried using the query count plugin script to alert if a query count is not satisfied. However upon testing out and examine the code, the following two issues came up :

  1. The Query DSL used to construct the query in elasticsearch-query.rb is not supported within ES2.x Query DSL. (filtered queries have gone the way of the dodo), instead the query needs to be modified to use a Bool query with a filter option along with a must/must_not/should option.
          'query' => {
            'filtered' => {
              'query' => {
                'query_string' => {
                  'default_field' => config[:search_field],
                  'query' => config[:query]
                }
              },
              'filter' => {
                'range' => {
                  config[:timestamp_field] => {
                    'gt' => es_date_start,
                    'lt' => end_time.strftime('%Y-%m-%dT%H:%M:%S')
                  }
                }
              }
            }
          }
        }

  1. The script seems to allow to query only against 1 field, the script should be enhanced to either accept a well formed ES query, or a Lucene Query (field_name:Fieldvalue AND anotherFieldName=differentFieldValue...) instead of insisting on a field option being provided
  2. as reference in Issue How to pass querystring as argument to check-es-query-count.rb #34 , the requirement of adding the option : --minutes-previous should not be mandatory for the script to function.
@majormoses majormoses added the Bug label May 10, 2017
@majormoses
Copy link
Member

@agastya71 could you put togethor a pr with the proposed changes and we can further discuss there?

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

No branches or pull requests

3 participants