Hi, Question
I am trying to combine 2 user search queries using AND and OR as operation. I am aware of combining queries where we can merge filters, but I want to merge entire queries like { {BIG Elastic Query1} AND {BIG Elastic Query2} }. Details For instance say a user performs a search for "batman in movies type with filters of Christian and Bale" and another query "Dark Knight in type tvshows with filters of Christopher Nolan". I want to combine both queries so I can look for both batman movies and Dark Knight tvshows, but not Dark knight movies or batman tvshows. For example, for the given queries I just want to run Query1 OR Query2 in the elasticsearch. Query 1: { "query": { "filtered": { "query": { "query_string":{ "query":"Batman", "default_operator":"AND", "fields":[ "Movies._all" ] } }, "filter": { "bool": { "must": [ { "query":{ "filtered":{ "filter":{ "and":[ { "term":{ "cast.firstName":"Christian" } }, { "term":{ "cast.lastName":"Bale" } } ] } } } } ] } } } } } Query2: { "query": { "filtered": { "query": { "query_string":{ "query":"Dark Knight", "default_operator":"AND", "fields":[ "tvshows._all" ] } }, "filter": { "bool": { "must": [ { "query":{ "filtered":{ "filter":{ "and":[ { "term":{ "director.firstName":"Christopher" } }, { "term":{ "director.lastName":"Nolan" } } ] } } } } ] } } } } } -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/be301214-1b6a-4065-8c8e-f1e5048e9873%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.