I dont think this is an issue with watcher, persay. I think you are asking how to replicate a complex discover query in elasticsearch. Since i was unaware how discover transformed the query you write to an elasticsearch query, I turned on logging of all queries and made a somewhat complex query. Its not a complex as yours, but I think you can figure it out from here. I am using the sample shakespeare dataset.
First, to set your elasticsearch cluster to log queries,
% curl -H'content-type:application/json' -XPUT "http://localhost:9200/_settings" -d'
{
"index.search.slowlog.threshold.query.debug": "0s"
}'
and I executed the following query in kibana
(Fifth OR Henry) AND whiles
and got the following logged (I have massaged the query output logged so its easier to read, removed all the \n etc...)
{
"query": {
"bool": {
"filter": [{
"bool": {
"filter": [{
"bool": {
"should": [{
"multi_match": {
"query": "Fifth",
"fields": [],
"type": "best_fields",
"operator": "OR",
"slop": 0,
"prefix_length": 0,
"max_expansions": 50,
"lenient": true,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"fuzzy_transpositions": true,
"boost": 1.0
}
}, {
"multi_match": {
"query": "Henry",
"fields": [],
"type": "best_fields",
"operator": "OR",
"slop": 0,
"prefix_length": 0,
"max_expansions": 50,
"lenient": true,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"fuzzy_transpositions": true,
"boost": 1.0
}
}],
"adjust_pure_negative": true,
"minimum_should_match": "1",
"boost": 1.0
}
}, {
"multi_match": {
"query": "whiles",
"fields": [],
"type": "best_fields",
"operator": "OR",
"slop": 0,
"prefix_length": 0,
"max_expansions": 50,
"lenient": true,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"fuzzy_transpositions": true,
"boost": 1.0
}
}],
"adjust_pure_negative": true,
"boost": 1.0
}
}],
"adjust_pure_negative": true,
"boost": 1.0
}
}
}
And once you have done this, you can apply a query like that to a watcher search input and get what you want. Just dont forget to turn the query logging back to a sane value once you have finished!