Hi, I would like to index hotel types in elasticsearch. Hotels have a per day price for example, a per day check-in/check-out and a per day minimum stay. My first approach was to have a map of all per day prices, for example:
referencePricePerDay: {
properties: {
2015-07-06: {
type: "double"
},
2015-07-07: {
type: "double"
},
2015-07-08: {
type: "double"
},
..........
a map for check-in, check-out, etc.
Pros: easy to query.
Cons: takes too much space, do not need to have old fields in the index, for example I do not need the prices for july anymore.
Second attempt would be to have all these fields concentrated in a nested object. For example
dateObject : {
day: 2015-07-08,
price: 30.0
check-in : true,
check-out: false
available: true
}
The problem is that to query this structure a nested query hast to be included for each day. For example the outer query would be a boolean query and for each day we would have a must.
Pros: no useless mappings saved .
Cons: hard to query, lower performance.
A third approach would be to have a per day index with the details for each hotel. The index can later be closed deleted. But then I would have at least 700 indices with the availabilities for the next 2 years.
Does anyone have a smart suggestion on how I can model my data?