Q:

In elasticsearch, is it possible to use regular queries for nested objects?

In my elasticsearch index I have documents with a property that is a nested object like so:
{
  "my_index": {
    "mappings": {
      "my_type": {
        "properties": {
          "nested_prop": {
            "type": "nested",
            "properties": {
              "subprop1": {
                "type": "boolean"
              },
              "subprop2": {
                "type": "keyword"
              }
            }
          }
        }
      }
    }
  }
}

I can search for objects with a nested query now, like so:
{
    "query": {
        "nested": {
            "path": "nested_prop",
            "query": {
                "bool": {
                    "must": [{
                        "term": {
                            "nested_prop.subprop1": "true"
                        }
                    }, {
                        "term": {
                            "nested_prop.subprop2": "SOME_KEY"
                        }
                    }]
                }
            }
        }
    }
}

So far so good. I'm building my elasticsearch queries with a pretty general mechanism from a querystring. So, I'd like to be able to still query the documents with a "regular" (non-nested) query like so:
{
    "query": {
        "term": {
            "nested_prop.subprop1": "true"
        }
    }
}

However, I only get empty results with that kind of query unless I wrap it into a nested query.
Is there a way to use a simple query with nested objects?

A:

That's not possible at the moment (ES 5.3.1) with query_string: https://github.com/elastic/elasticsearch/issues/16551.
For other queries, no matter what you do with your nested fields, you need to have a nested query to make use of it.

