Hi,
I'm very new to Elasticsearch and I'm trying a simple test like this:
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
JsonObject event = Json.createObjectBuilder().add("d", 44).build();
IndexResponse response = client.prepareIndex("myindex", "mytype").setSource(event).get();
I'm expecting the field "d" to be recognized as integer or long but it enters as text:
{
"myindex": {
"aliases": {},
"mappings": {
"mytype": {
"properties": {
"d": {
**"type": "text",**
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
},
"settings": {
"index": {
"creation_date": "1485890042953",
"number_of_shards": "5",
"number_of_replicas": "1",
"uuid": "vZpTJhDfREC7viQvESQFKQ",
"version": {
"created": "5000099"
},
"provided_name": "myindex"
}
}
}
}
if I'm adding the same object from the command line using curl it does enter as long. So what is the problem with this simple code?
Thanks