According the documents below :
How do I get all documents that
field driver.vehicle.make = Powell Motors" and this field has the max year in the array ?
(It should return only doc 1 and doc 3)
I would like it will be executed in one query
Hi Aaron ,
Let's look at the array of "vehicle" objects for each document.
I want to get all documents in which has object that meets the following conditions :
Field "year" of that object is maximum in the array and the Field "make" of this object == "Powell Motors"
doc 1 : Max year is 2020 (>2005) .
The object with the max year is :
Field "make" of this object equals to "Miller-Meteor". (Does not meet the requirement. Object "make" field equals to "Miller-Meteor" and not "Powell Motors" as required)
doc 3: Max year is 2003.
The object with the max year is :
{
"make": "Powell Motors",
"model": "Canyonero",
"year": 2003
}
Field "make" of this object equals to "Powell Motors"(conditions are met)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.