# Elastic Mapping

**URL:** <https://discuss.elastic.co/t/elastic-mapping/106469>\
**Category:** Elasticsearch\
**Created:** [November 6, 2017, 6:24am UTC](https://discuss.elastic.co/t/elastic-mapping/106469 "2017-11-06T06:24:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shekhar\_Pandey](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shekhar\_Pandey](https://discuss.elastic.co/u/Shekhar_Pandey)\
**Post date:** [November 6, 2017, 6:24am UTC](https://discuss.elastic.co/t/elastic-mapping/106469/1 "2017-11-06T06:24:32Z")

</div>

I saw one article where they are doing mapping directly dynamic after create two mapping which are given below:

My question is how elastic automatically predict it will goes to keword\_facet or long\_facet....Means we have to change in database something , so that elastic will understand or I am wrong somewhere....  
article link is [https://codeburst.io/elasticsearch-by-example-part-4-cd11928a579e](https://codeburst.io/elasticsearch-by-example-part-4-cd11928a579e)  
{  
"entity": {  
"name": "tshirt"  
},  
"keyword\_facets": [  
{  
"facet\_name": "size",  
"facet\_value": "S"  
},  
{  
"facet\_name": "color",  
"facet\_value": "black"  
},  
{  
"facet\_name": "fabric",  
"facet\_value": "cotton"  
}  
],  
"long\_facets": [  
{  
"facet\_name": "price",  
"facet\_value": 1000  
}  
]  
}  
Observations:  
Moved the descriptive name property under an entity property; this is where I anticipate placing other non-facet related properties.  
We divide the facet data based on types: keyword and long.  
Create (Revisited)  
Assuming that we are using the same cluster environment, we need to delete the existing shirts index.  
DELETE: ENDPOINT/shirts  
and then recreate it as follows:  
PUT: ENDPOINT/shirts  
{  
"settings": {  
"number\_of\_shards": 1,  
"number\_of\_replicas": 1  
},  
"mappings": {  
"shirt": {  
"properties": {  
"entity": {  
"properties": {  
"name": {  
"type": "text"  
}  
}  
},  
"keyword\_facets": {  
"type": "nested",  
"properties": {  
"facet\_name": {  
"type": "keyword"  
},  
"facet\_value": {  
"type": "keyword"  
}  
}  
},  
"long\_facets": {  
"type": "nested",  
"properties": {  
"facet\_name": {  
"type": "keyword"  
},  
"facet\_value": {  
"type": "long"  
}  
}  
}  
}  
}  
}  
}

---

<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 7, 2017, 1:05am UTC](https://discuss.elastic.co/t/elastic-mapping/106469/2 "2017-11-07T01:05:21Z")

</div>

> [@Shekhar\_Pandey](#):
>
> My question is how elastic automatically predict it will goes to keword\_facet or long\_facet

It doesn't do anything like that. It does what the client asks.

---

<div class="post-metadata">

**Author:** ![Shekhar\_Pandey](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shekhar\_Pandey](https://discuss.elastic.co/u/Shekhar_Pandey)\
**Post date:** [November 7, 2017, 4:32am UTC](https://discuss.elastic.co/t/elastic-mapping/106469/3 "2017-11-07T04:32:04Z")

</div>

So, its no possible through mysql bcz we not able to pass array time data..so this is nosql or other json format database....bcz they keep in schema and it automatically fetching similar data that is possible through only array. I am right or wrong sir.

---

<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 7, 2017, 4:42am UTC](https://discuss.elastic.co/t/elastic-mapping/106469/4 "2017-11-07T04:42:51Z")

</div>

I'm not clear on what you are asking sorry.

---

<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:** [December 5, 2017, 4:42am UTC](https://discuss.elastic.co/t/elastic-mapping/106469/5 "2017-12-05T04:42:58Z")

</div>

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