I have unit_type documents that have nested rent documents. The rent documents have a price property and an effective_date property. I want to filter unit_types and sort the nested rent documents by their effective date. The rent documents are not stored in sorted order currently. If this cannot be done with a nested data type, can it be done with parent/child?
I am using v1.6
Here is my index mapping:
{
"unit_types_v1": {
"aliases": {
"unit_types": {}
},
"mappings": {
"unit_type": {
"properties": {
"id": {
"type": "long"
},
"property_id": {
"type": "long"
},
"rents": {
"type": "nested",
"properties": {
"effective_date": {
"type": "date",
"format": "dateOptionalTime"
},
"id": {
"type": "long"
},
"price": {
"type": "double"
},
"unit_type_id": {
"type": "long"
}
}
}
}
}
}
}
}