I have windows 7 32 bit os
Elastic search is running separately
Java Version: 1.7.0_25
I am new to elastic search, I have not made any changes in
elasticsearch.yml file
I have added the mapping using chrome plugin sense
Mapping
gatereader/gate/_mapping
{
"gate" : {
"_id":{
"path":"id"
},
"properties": {
"id" : {"type": "long"},
"name" : {"type": "string"},
"description" : {"type": "string"},
"isActive" : {"type": "boolean"},
"gateReaderEntityList" :
{"type": "object",
"properties": {
"id" : {"type": "long"},
"readerName" : {"type": "string"},
"readerRefName" : {"type": "string"},
"isActive" : {"type": "boolean"},
"readerType" : {"type": "string"}
}
}
}
}
}
JSON String:
{"id":1,"isActive":true,"description":"","name":"gate","gateReaderEntityList":[{"id":1,"isActive":true,"readerRefName":"Reader","readerType":{"readerType":"Exit"},"readerName":"Reader1"},{"id":2,"isActive":true,"readerRefName":"Reader2","readerType":{"readerType":"Exit"},"readerName":"Reader2"},{"id":3,"isActive":true,"readerRefName":"Reader3","readerType":{"readerType":"Exit"},"readerName":"Reader3"},{"id":4,"isActive":true,"readerRefName":"ExReader1","readerType":{"readerType":"Exit"},"readerName":"ExReader1"},{"id":5,"isActive":true,"readerRefName":"ExReader2","readerType":{"readerType":"Exit"},"readerName":"ExReader2"}]}
Java Code:
Settings settings = ImmutableSettings.settingsBuilder().put()
.put("client.transport.ignore_cluster_name", false).build();
Client client = new
TransportClient(settings).addTransportAddress(new
InetSocketTransportAddress("localhost", 9300));
IndexResponse response1 = client.prepareIndex("gatereader",
"gate", String.valueOf(1))
.setSource(jsonstring).execute().actionGet();
I am getting exception
java.lang.ArrayIndexOutOfBoundsException: 1
at
org.elasticsearch.action.index.IndexRequest.source(IndexRequest.java:419)
at
org.elasticsearch.action.index.IndexRequestBuilder.setSource(IndexRequestBuilder.java:209)
at
waidTenant.ApplicationContextLoader.elasticsearch(ApplicationContextLoader.java:230)
at
waidTenant.ApplicationContextLoader.main(ApplicationContextLoader.java:164)
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.