# Help with elasticsearch mapping

**URL:** <https://discuss.elastic.co/t/help-with-elasticsearch-mapping/34671>\
**Category:** Elasticsearch\
**Created:** [November 16, 2015, 11:36am UTC](https://discuss.elastic.co/t/help-with-elasticsearch-mapping/34671 "2015-11-16T11:36:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![archie](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@archie](https://discuss.elastic.co/u/archie)\
**Post date:** [November 16, 2015, 11:36am UTC](https://discuss.elastic.co/t/help-with-elasticsearch-mapping/34671/1 "2015-11-16T11:36:33Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 17, 2015, 4:41am UTC](https://discuss.elastic.co/t/help-with-elasticsearch-mapping/34671/2 "2015-11-17T04:41:34Z")

</div>

It sounds like you have most of this covered and you're going to have to pay a cost somewhere, you just need to decide which is most acceptable!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:38pm UTC](https://discuss.elastic.co/t/help-with-elasticsearch-mapping/34671/3 "2017-07-05T23:38:02Z")

</div>


