# Problem creating an index having any field with data type "string"

**URL:** <https://discuss.elastic.co/t/problem-creating-an-index-having-any-field-with-data-type-string/188052>\
**Category:** Elasticsearch\
**Created:** [June 28, 2019, 1:16pm UTC](https://discuss.elastic.co/t/problem-creating-an-index-having-any-field-with-data-type-string/188052 "2019-06-28T13:16:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nirajan](https://avatars.discourse-cdn.com/v4/letter/n/6bbea6/32.png) [@Nirajan](https://discuss.elastic.co/u/Nirajan)\
**Post date:** [June 28, 2019, 1:16pm UTC](https://discuss.elastic.co/t/problem-creating-an-index-having-any-field-with-data-type-string/188052/1 "2019-06-28T13:16:44Z")

</div>

Hello Everybody,

I want to create an index having many fields with different data types. But i am facing some strange problems lately.  
I have an index mapping with fields of data types "double", "integer", "string"; when i try to create an index with these data types, i dont get any error messages but the index is not created in the elastic search.

But when i replace the "string" data type of all the fields with the data type "text", then everything is fine. I can see the mapping of an index (with kibana) and also the index itself.

I want to have fields with data type "text" and "string" in an index.

Any suggestions?

Best Regards,  
Nirajan

---

<div class="post-metadata">

**Author:** ![whatgeorgemade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/whatgeorgemade/32/103246_2.png) [@whatgeorgemade](https://discuss.elastic.co/u/whatgeorgemade)\
**Post date:** [June 28, 2019, 1:32pm UTC](https://discuss.elastic.co/t/problem-creating-an-index-having-any-field-with-data-type-string/188052/2 "2019-06-28T13:32:35Z")

</div>

`string` isn't a data type in Elasticsearch. You'll need to choose between `text` and `keyword` for storing text data. Which one you choose will affect the type of queries you can run against the field.

---

<div class="post-metadata">

**Author:** ![Nirajan](https://avatars.discourse-cdn.com/v4/letter/n/6bbea6/32.png) [@Nirajan](https://discuss.elastic.co/u/Nirajan)\
**Post date:** [June 28, 2019, 1:52pm UTC](https://discuss.elastic.co/t/problem-creating-an-index-having-any-field-with-data-type-string/188052/3 "2019-06-28T13:52:41Z")

</div>

Hello George,

Thank you very much for your suggestion.  
I replaced "text" with "keyword" and it works.

Have a great weekend..

Best Regards,  
Nirajan

---

<div class="post-metadata">

**Author:** ![Nirajan](https://avatars.discourse-cdn.com/v4/letter/n/6bbea6/32.png) [@Nirajan](https://discuss.elastic.co/u/Nirajan)\
**Post date:** [June 28, 2019, 4:36pm UTC](https://discuss.elastic.co/t/problem-creating-an-index-having-any-field-with-data-type-string/188052/4 "2019-06-28T16:36:15Z")

</div>

Hello George,

During pie chart visualization with Terms Aggregation in kibana, only one of two fields of data type "keyword" is shown in the FIELD section of Pie Chart Visualization. Is it possible to show all fields with data type "keyword"?

Best Regards,  
Nirajan

---

<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 26, 2019, 4:36pm UTC](https://discuss.elastic.co/t/problem-creating-an-index-having-any-field-with-data-type-string/188052/5 "2019-07-26T16:36:31Z")

</div>

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