Question: Given JSON in ES index in the following format:

```
{
    "pin": {
        "id": 123,
        "location": {
            "lat": 456,
            "lon":-789
        }
    }
}

```

The following gets the document matching the `id` field:

```
client.prepareSearch("index_name")
        .setTypes("pin")
        .setQuery(QueryBuilders.termQuery("id", 123))
        .execute()
        .actionGet();

```

Instead, I 'm trying to match multiple fields, ie. (`location.lat`, `location.lon`).

```
QueryBuilders.termQuery(); // accepts only a single term

```

Tried few alternatives but none of it seems to work, eg:

```
QueryBuilder queryBuilder = QueryBuilders.boolQuery()
        .must(QueryBuilders.termQuery("location.lat", 456))
        .must(QueryBuilders.termQuery("location.lon", -789));

client.prepareSearch("index_name")
        .setTypes("pin")
        .setQuery(queryBuilder)
        .execute()
        .actionGet();

```

Answer: 
By default, a geo\_point field is not indexed as two fields (location.lat and location.lon), it's indexed as a single field that contains both latitude and longitude. 

You can turn on indexing of latitude and longitude by turning on the `lat_lon` [mapping option](http://www.elasticsearch.org/guide/reference/mapping/geo-point-type.html). However, in your example, the values for latitude and longitude are too large. So, they are normalized, converted to double and indexed as -84.0 and -69.0 instead of 456 and -789. So, if you will enable `lat_lon` and replace the value in the queries, you should be able to get the results. 

Please note that values for latitude and longitude are converted to double before indexing. So using term queries might not be very practical in the long term since you will have to always take rounding errors into consideration. It might be more useful to use [range queries](http://www.elasticsearch.org/guide/reference/query-dsl/range-query.html) or elasticsearch [geospatial queries](http://www.elasticsearch.org/guide/reference/query-dsl/geo-distance-filter.html) instead.
Check out the [bool query](http://www.elasticsearch.org/guide/reference/query-dsl/bool-query.html) in ElasticSearch, you should be able to specify `must`, `should` or `should_not` to get the appropriate mixture of and/or for your query.