Lucene query not working as expected

Hi all
trying to query our ES datasource and got weird results
Query is: (report_name : *report1* OR report_name : *report2*) AND NOT (report_name : *processing*)

I’ve got all results like I dont have any conditions in Query
Sample result:

report1 - 100
report2 - 10
report3 - 0
report4 - 0
report1.1 - 0
report2.1 - 0
report2.processing - 0
report5 - 0

I expect results as below:

report1 - 100
report2 - 10
report1.1 - 0
report2.1 - 0

If I set “Min Doc Count”: 1, then I get desired result but without 0 values:

report1 - 100
report2 - 10

what could be the issue here? and how can I get desired result including 0 values in count?


1 Like

Try put 1 in the Min Doc Count and Order By with Term Value

thanks, but it still doesnt resolve my issue
I want to see full set of *report1* and *report2* records even though count is equal to 0

I think you need to use workaround:

  1. Create variable report that select all reports

  2. Put the regex like /report1|report2/ , it will include report2.processing
    3.Select Option ALL

  3. Hide the variable

  4. use this query:

report_name : $report AND NOT (report_name : *processing*)

Lets see what happen…

thanks for your suggestion but it doesnt work either
I still do not see records that matches my mask but have zero counts
again, if I set “Min Doc Count” to 0 - have full list of items and nothins filtered

1 Like