I'm trying to search Address object with nested attribute using MultiMatchQuery. But I'm getting following error. Great if some one can help on it.
Document in ES index
```
{
"_index": "admin-order-v1-test4",
"_type": "_doc",
"_id": "4bf27333-fb5c-4956-aa3b-a48e0562e3f3",
"_score": 1.0,
"_source": {
"id": "4rrrwf4-fb5c-4956-aa3b-323423dsfsds",
"createdAt": 1588650264000,
"fromAddress": {
"street": "abc",
"streetNumber": "16",
"latitude": null,
"longitude": null,
"zipCode": "13796",
"city": "Stockholm",
"countryCode": "SE"
}
}
**Query in spring boot** :
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
if (queryMap.get("fromAddress") != null) {
queryBuilder.filter(
QueryBuilders.multiMatchQuery("fromAddress",
"fromAddress.street",
"fromAddress.streetNumber",
"fromAddress.latitude",
"fromAddress.longitude",
"fromAddress.zipCode",
"fromAddress.city",
"fromAddress.countryCode")
.type(Type.MOST_FIELDS));
}
SearchSourceBuilder searchSource =
SearchSourceBuilder.searchSource()
.query(queryBuilder)
.explain(true)
.sort(SortBuilders.fieldSort("createdAt").order(SortOrder.DESC))
.from(Integer.parseInt(queryMap.get("page")))
.size(
Math.min(Integer.parseInt(queryMap.get("size")), MAXIMUM_NUMBER_OF_HITS_PER_PAGE));
SearchRequest searchRequest =
new SearchRequest(elasticSearchProperties.getIndex())
.searchType(SearchType.DFS_QUERY_THEN_FETCH)
.source(searchSource);
I'm Getting following error:
"ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]"