# Elastic Search Fields Mapping to String

**URL:** <https://discuss.elastic.co/t/elastic-search-fields-mapping-to-string/24049>\
**Category:** Elasticsearch\
**Created:** [June 21, 2015, 6:41pm UTC](https://discuss.elastic.co/t/elastic-search-fields-mapping-to-string/24049 "2015-06-21T18:41:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![depp1993](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/depp1993/32/3526_2.png) [@depp1993](https://discuss.elastic.co/u/depp1993)\
**Post date:** [June 21, 2015, 6:41pm UTC](https://discuss.elastic.co/t/elastic-search-fields-mapping-to-string/24049/1 "2015-06-21T18:41:59Z")

</div>

Hi,

Let me first explain my scenario.  
I am fetching data from RDBMS and pushing it into ElasticSearch.  
Fetched Results are in the form of List\<Map\<String,Object\> and i am preparing bulk index request like this:

```
BulkRequestBuilder bulkRequest = client.prepareBulk(); 
for (Map<String,Object> singleDataRow : ResultSet) 
{ 
       IndexRequest indexRequest = new IndexRequest("testindex","testtype",singleDataRow.getObject("NAME")); 
       bulkRequest.add(indexRequest); 
} 

bulkRequest.execute().actionGet(); 

```

My map\<String,Object\> = includes Map of string to string, string to big decimal, string to big integer etc.

But when i see the mapping of my testtype in testindex, all mapping of fields are of "type" : "string"

??

Why the fields does not maps to "type": "string" , or "type" : "long" , and even "type" : "date" because my map includes data like :

```
{ "BIRTHDATE" : "2015-03-05" , "NAME" : "deepankar" , "AGE" : "22" }
```

---

<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 6, 2017, 12:06am UTC](https://discuss.elastic.co/t/elastic-search-fields-mapping-to-string/24049/2 "2017-07-06T00:06:15Z")

</div>

Closed on July 6, 2017, 12:06am UTC


