# Help in defining a schema

**URL:** <https://discuss.elastic.co/t/help-in-defining-a-schema/49805>\
**Category:** Elasticsearch\
**Created:** [May 11, 2016, 5:05pm UTC](https://discuss.elastic.co/t/help-in-defining-a-schema/49805 "2016-05-11T17:05:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deep](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@Deep](https://discuss.elastic.co/u/Deep)\
**Post date:** [May 11, 2016, 5:05pm UTC](https://discuss.elastic.co/t/help-in-defining-a-schema/49805/1 "2016-05-11T17:05:44Z")

</div>

Hi,

I have 15-20 fields in my elastic search document using which a user can filter data to fetch relevant documents. These filters are of type string.

All these filters are not defined for all the documents. In the current implementation I assign a value of 'U' to unused filters and valid values to relevant filters. During search we match all the filters. Filters not specified are matched against 'U'. For some of the filters we have a predefined set of values like gender can be Male (M), Female (F), Undefined (U).

Please suggest best way to define these filters. Would it be better to use integer values like 1, 2 etc instead of strings. Will it improve performance.

Regards,  
Deep

---

<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 12, 2016, 12:53am UTC](https://discuss.elastic.co/t/help-in-defining-a-schema/49805/2 "2016-05-12T00:53:14Z")

</div>

> [@Deep](#):
>
> Please suggest best way to define these filters. Would it be better to use integer values like 1, 2 etc instead of strings. Will it improve performance.

Just use what you have, the bitsets that the filters create will not be improved by using numbers.

---

<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, 10:52pm UTC](https://discuss.elastic.co/t/help-in-defining-a-schema/49805/3 "2017-07-05T22:52:19Z")

</div>


