Elastic Search Fields Mapping to String

(Deepankar Singh) #1


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")); 


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" }

(system) #2