Hello, we are experiencing issues with one query in particular, however this is only happening ocassionally and we can't figure out the source of the problem.
The query is working fine
get homes/_search
{
"size": 0,
"query": {
"bool": {
"filter": [
{
"match": {
"location_2": 5168
}
},
{
"match": {
"operation": "sale"
}
},
{
"nested": {
"path": "offers",
"inner_hits": {
"_source": [
"offers.id"
]
},
"query": {
"bool": {
"filter": [
{
"match": {
"offers.location_2": 5168
}
},
{
"match": {
"offers.operation": "sale"
}
}
]
}
}
}
},
{
"geo_shape": {
"location": {
"shape": """
POLYGON((
-5.847290754318238 43.359096194564316,
-5.842151641845704 43.359096194564316,
-5.842151641845704 43.355542934897514,
-5.847290754318238 43.355542934897514,
-5.847290754318238 43.359096194564316
))
""",
"relation": "within"
}
}
}
]
}
},
"aggs": {
"clusters": {
"geotile_grid": {
"field": "location",
"precision": 20
},
"aggs": {
"hits": {
"top_hits": {
"size": 100,
"_source": [
"offers.id" ]
}
}
}
}
}
}
However this one:
get homes/_search
{
"size": 0,
"query": {
"bool": {
"filter": [
{
"match": {
"location_2": 5168
}
},
{
"match": {
"operation": "sale"
}
},
{
"nested": {
"path": "offers",
"inner_hits": {
"_source": [
"offers.id"
]
},
"query": {
"bool": {
"filter": [
{
"match": {
"offers.location_2": 5168
}
},
{
"match": {
"offers.operation": "sale"
}
}
]
}
}
}
},
{
"geo_shape": {
"location": {
"shape": """
POLYGON((
-5.8480310440063485 43.36549231759247,
-5.83775281906128 43.36549231759247,
-5.83775281906128 43.35838633934203,
-5.8480310440063485 43.35838633934203,
-5.8480310440063485 43.36549231759247
))
""",
"relation": "within"
}
}
}
]
}
},
"aggs": {
"clusters": {
"geotile_grid": {
"field": "location",
"precision": 20
},
"aggs": {
"hits": {
"top_hits": {
"size": 100,
"_source": [
"offers.id"
]
}
}
}
}
}
}
Gives the following error
{
"error": {
"root_cause": [
{
"type": "illegal_state_exception",
"reason": "Error retrieving path offers"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "homes",
"node": "4lIopJZcRAGJHd_DnSlSeg",
"reason": {
"type": "illegal_state_exception",
"reason": "Error retrieving path offers"
}
}
],
"caused_by": {
"type": "illegal_state_exception",
"reason": "Error retrieving path offers",
"caused_by": {
"type": "illegal_state_exception",
"reason": "Error retrieving path offers"
}
}
},
"status": 500
}
The field "offers" is mapped as nested. We also have other index with similar mappings where the queries work without any errors or warnings.
Any idea what the issue can be?