# Is there any way to generate Index definition from Entities?

**URL:** <https://discuss.elastic.co/t/is-there-any-way-to-generate-index-definition-from-entities/126618>\
**Category:** Elasticsearch\
**Created:** [April 3, 2018, 5:24pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-generate-index-definition-from-entities/126618 "2018-04-03T17:24:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hym](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hym/32/22399_2.png) [@hym](https://discuss.elastic.co/u/hym)\
**Post date:** [April 3, 2018, 5:24pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-generate-index-definition-from-entities/126618/1 "2018-04-03T17:24:35Z")

</div>

I am looking for a way to generate Index mapping definition from entities.  
I have to run the same application in two environments with different versions of Elastic search (2.1.x and 5.x).  
What came to my mind is to have all information for mapping in Entities (by annotation) and when the application running in 2.1.x env generate Index for that environment and when it is running in 5.x env generate Index for that.

Is there any way to address this issue. If I create two different mapping files I would have to apply any changes in both files which I don't like.

---

<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:** [May 1, 2018, 5:25pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-generate-index-definition-from-entities/126618/2 "2018-05-01T17:25:00Z")

</div>

Closed on May 1, 2018, 5:25pm UTC

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