Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

Elasticsearch _search query with filter bug

Re-Open
test0test0test asked on October 8, 2020

The elasticsearch _search produces different queries on multiple instances even though the same filters are being selected.
For example,
Filter

  1. Apple
  2. Orange  <selected>
  3. Pear      <selected>

When the search is fired to elasticsearch, these are the two variations that appear on multiple instances

1. query: bool : must : [] must_not: bool:  should: term : Apple

2. query: bool : must : bool:  should: term : Orange term: Pear must_not: []
This two different queries return very different results, given that my records contain attributes that are arrays.

Record 1               Fruits: [Apple, Orange, Pear]
Record 2               Fruits: []
Happened on v2.8.17 of flexmonster 

4 answers

Public
Milena Pechura Milena Pechura Flexmonster October 9, 2020

Hello!
 
Thank you for posting to our forum.
 
We would like to kindly explain that sending different filter queries is expected behavior. Depending on the user actions (select or deselect) the corresponding must or must_not clause will appear in the query.
 
However, receiving different results is not expected.
Could you please provide us with the sample Elasticsearch index that returns different results for the same filter? Your report and steps to reproduce the issue would also greatly help us in our investigation.
 
Looking forward to your response.
 
Best regards,
Milena

Public
test0test0test October 12, 2020

Hello,
Elasticsearch:  v7.9.2
Flexmonster: v2.8.17

Sample data:
{“index”: {“_type”:”index1″}}
{“id” : “1”, “fruits”: [“Apple”, “Orange”, “Pear”]}
{“index”: {“_type”:”index1″}}
{“id” : “2”, “fruits”: [“Apple”, “Orange”, “Pear”]}
{“index”: {“_type”:”index1″}}
{“id” : “3”, “fruits”: [“Apple”, “Orange”, “Pear”]}
 
Load the dataset, click on the filter, uncheck Apple, search.
query: bool : must : [] must_not: bool:  should: term : Apple
Click on the filter, uncheck Orange, check Apple and Pear, search.
Click on the filter again, uncheck Apple, check Orange and Pear, search.

query: bool : must : bool:  should: term : Orange term: Pear must_not: []

Public
Milena Pechura Milena Pechura Flexmonster October 13, 2020

Hello,
 
Thank you for providing further info about the component behavior.
 
Our team is going to research the issue and provide you with results ETA Nov 16.
 
Please let us know if it works for you and if any other questions arise.
 
Best regards,
Milena

Public
test0test0test 14 hours ago

Yup will be waiting for your reply
 
Thank you!

Please login or Register to Submit Answer