Conditional statement in Elastic Search using spring

I am new to elastic search and there is a case where I have to search for some value say 'x' in indexed column 'y' and if there is no similar value find in 'y' then check in indexed column 'z'.

Currently I tried BoolQueryBuilder.must() and BoolQueryBuilder.should() but didn't know how to apply this conditional approach with the elastic search query.

Any suggestions? Thanks in Advance.

Read more here:

Content Attribution

This content was originally published by Anubhav at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: