I know this has been asked multiple times before but none of the existing questions or answers have helped me.
I am getting the following error when querying Elasticsearch:
[nested] failed to find nested object under path [departures]
The query I am running is below:
{
"explain":true,
"from":0,
"query":{
"nested":{
"path":"departures",
"query":{
"term":{
"departures.yearMonth":{
"value":202007
}
}
}
}
},
"size":20
}
And my mapping is as follows:
{
"tours":{
"mappings":{
"properties":{
"departures":{
"type":"nested",
"properties":{
"guaranteed":{
"type":"boolean"
},
"spacesRemaining":{
"type":"long"
},
"startDate":{
"type":"date"
},
"yearMonth":{
"type":"long"
}
}
}
}
}
}
}
And finally, a screenshot taken from Kibana showing that there is a valid entry in my index.

Any ideas why this query would be failing like this?
nestedfield mapping?