# Problem with index field type when add data to index

**URL:** <https://forum.opensearch.org/t/problem-with-index-field-type-when-add-data-to-index/18152>\
**Category:** OpenSearch\
**Tags:** troubleshoot\
**Created:** [February 28, 2024, 1:07pm UTC](https://forum.opensearch.org/t/problem-with-index-field-type-when-add-data-to-index/18152 "2024-02-28T13:07:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![himansutecstub](https://avatars.discourse-cdn.com/v4/letter/h/ec9cab/32.png) [@himansutecstub](https://forum.opensearch.org/u/himansutecstub)\
**Post date:** [February 28, 2024, 1:07pm UTC](https://forum.opensearch.org/t/problem-with-index-field-type-when-add-data-to-index/18152/1 "2024-02-28T13:07:21Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
[2.11.0]

**Describe the issue** :  
I create new index using

```auto
curl -X PUT "https://your-opensearch-cluster:9200/indexname" -H 'Content-Type: application/json' -d '
{
  "mappings": {
    "properties": {
      "ENTITY_ID": {
        "type": "text"
      },
      "NAME" : {
        "type": "text"
      }....
    }
  }
}'

```

But when fill data in that index with ENTITY\_ID as integer value from mysql database than below index type converted to `long` i want to keep as `text` so is there any method?

Same problem with `date` type. when any customer DOB is not found than also it’s converted to `text`.

---

<div class="post-metadata">

**Author:** ![Gsmitt](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/gsmitt/32/1718_2.png) [@Gsmitt](https://forum.opensearch.org/u/Gsmitt)\
**Post date:** [March 1, 2024, 2:53am UTC](https://forum.opensearch.org/t/problem-with-index-field-type-when-add-data-to-index/18152/2 "2024-03-01T02:53:34Z")

</div>

Hey @himansutecstub

Can I ask how your shipping those log from MySQL to Opensearch?

---

<div class="post-metadata">

**Author:** ![himansutecstub](https://avatars.discourse-cdn.com/v4/letter/h/ec9cab/32.png) [@himansutecstub](https://forum.opensearch.org/u/himansutecstub)\
**Post date:** [March 1, 2024, 4:42am UTC](https://forum.opensearch.org/t/problem-with-index-field-type-when-add-data-to-index/18152/3 "2024-03-01T04:42:55Z")

</div>

Using PHP code get data from mysql database, Create array for send data in opensearch & send post data via curl.

---

<div class="post-metadata">

**Author:** ![Gsmitt](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/gsmitt/32/1718_2.png) [@Gsmitt](https://forum.opensearch.org/u/Gsmitt)\
**Post date:** [March 1, 2024, 4:46am UTC](https://forum.opensearch.org/t/problem-with-index-field-type-when-add-data-to-index/18152/4 "2024-03-01T04:46:03Z")

</div>

Can you show your configuration on that PHP code?
