I have an index with a mapping something like this:
"email" : {
  "type" : "nested",
  "properties" : {
    "from" : {
      "type" : "text",
      "analyzer" : "lowercase_keyword",
      "fielddata" : true
    },
    "subject" : {
      "type" : "text",
      "analyzer" : "lowercase_keyword",
      "fielddata" : true
    },
    "to" : {
      "type" : "text",
      "analyzer" : "lowercase_keyword",
      "fielddata" : true
    }
  }
},
"textExact" : {
  "type" : "text",
  "analyzer" : "lowercase_standard",
  "fielddata" : true
}
I want to use query_string to search for matches in both the nested and the non-nested field at the same time, e.g.
email.to:foo@example.com AND textExact:bar
But I can't figure out how to write a query that will search both fields at once. The following doesn't work, because query_string searches do not return nested documents:
"query": {
  "query_string": {
    "fields": [
      "textExact",
      "email.to"
    ],
    "query": "email.to:foo@example.com AND textExact:bar"
  }
}
I can write a separate nested query, but that will only search against nested fields. Is there any way I can use query_string to match both nested and non-nested fields at the same time?