I am creating a hotel reservation system using Elasticsearch and trying to find a way to return hotels with a variable number of available dates (e.g. 7 days) in a date range
Currently, I store dates and prices as a children's document in the hotel, but I donβt know how to search or if it is possible even with my current setting?
Edit: Added Mappings
Hotel mapping
{
"hotel":{
"properties":{
"city":{
"type":"string"
},
"hotelid":{
"type":"long"
},
"lat":{
"type":"double"
},
"long":{
"type":"double"
},
"name":{
"type":"multi_field",
"fields":{
"name":{
"type":"string"
},
"name.exact":{
"type":"string",
"index":"not_analyzed",
"omit_norms":true,
"index_options":"docs",
"include_in_all":false
}
}
},
"star":{
"type":"double"
}
}
}
}
Date display
{
"dates": {
"_parent": {
"type": "hotel"
},
"_routing": {
"required": true
},
"properties": {
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"price": {
"type": "double"
}
}
}
}
I am currently using a date range to select the available dates, and then a field query to match the city - the rest of the fields will be used later
source
share