# Right mapping?

**URL:** <https://discuss.elastic.co/t/right-mapping/132575>\
**Category:** Elasticsearch\
**Created:** [May 19, 2018, 6:28pm UTC](https://discuss.elastic.co/t/right-mapping/132575 "2018-05-19T18:28:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![remco\_zwaan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remco_zwaan/32/129991_2.png) [@remco\_zwaan](https://discuss.elastic.co/u/remco_zwaan)\
**Post date:** [May 19, 2018, 6:28pm UTC](https://discuss.elastic.co/t/right-mapping/132575/1 "2018-05-19T18:28:13Z")

</div>

Hi,

Each property has availabity. We make for each property 365 available days in our index. When a property is booked we remove the dates from the index. This works ok.

Now we want a step further. We have price diversity per number of guests. So we want to store in de index prices based on number of guest.

What is the best data mapping to do this? We have now this, but i am not sure if this is the right mapping ?

```
  "properties": {
              "adults": {
                "type": "long"
              },
              "availability_adults": {
                "type": "long"
              },
              "availability_children": {
                "type": "long"
              },
              "availability_infants": {
                "type": "long"
              },
              "availability_price": {
                "type": "float"
              },
              "available_on": {
                "type": "date"
```

---

<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:** [May 20, 2018, 8:14am UTC](https://discuss.elastic.co/t/right-mapping/132575/2 "2018-05-20T08:14:37Z")

</div>

> [@remco\_zwaan](#):
>
> We have price diversity per number of guests. So we want to store in de index prices based on number of guest.

Does that change over time?

---

<div class="post-metadata">

**Author:** ![remco\_zwaan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remco_zwaan/32/129991_2.png) [@remco\_zwaan](https://discuss.elastic.co/u/remco_zwaan)\
**Post date:** [May 20, 2018, 8:56am UTC](https://discuss.elastic.co/t/right-mapping/132575/3 "2018-05-20T08:56:00Z")

</div>

yes it does. Sometimes we lower or higher the price. In case of promotions ect

---

<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:** [May 20, 2018, 9:29am UTC](https://discuss.elastic.co/t/right-mapping/132575/4 "2018-05-20T09:29:52Z")

</div>

Your mapping looks ok but you may want to look at an `integer` or a `short` to improve things.

Also, have you considered changing this into a time based structure? Then you do things like see changes over time for a property.

---

<div class="post-metadata">

**Author:** ![remco\_zwaan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remco_zwaan/32/129991_2.png) [@remco\_zwaan](https://discuss.elastic.co/u/remco_zwaan)\
**Post date:** [May 20, 2018, 9:57am UTC](https://discuss.elastic.co/t/right-mapping/132575/5 "2018-05-20T09:57:24Z")

</div>

i give you example how its stored in postgress DB

**Property X**

1 - 30 june / 4 adults = 200 per day  
1 - 30 june / 6 adults = 300 per day  
1 - 30 june / 4 adults + 2 children = 250 per day

1 - 31 july / 4 adults = 300 per day  
1 - 31 july / 6 adults = 350 per day  
1 - 31 july / 4 adults + 2 children = 350 per day

ect

**Property Y**

1 - 30 june / 2 adults = 100 per day  
1 - 30 june / 3 adults =120 per day  
1 - 30 june / 4 adults = 150 per day  
1 - 30 june / 2 adults + 1 child = 110 per day  
1 - 30 june / 2 adults + 2 child = 120 per day

ect

We initiale define the price strategy / entry at beginning of the season. In the season prices can changes in case of promotions ect.

remco

---

<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:** [June 17, 2018, 9:57am UTC](https://discuss.elastic.co/t/right-mapping/132575/6 "2018-06-17T09:57:24Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
