We have a java application which embeds elasticsearch instances on multiple
servers, and starts them as follows:
node = nodeBuilder().client(false).local(false).node();
client = node.client();
//wait for ready
client.admin().cluster().health(newClusterHealthRequest().waitForYellowStatus()).actionGet();
This work fine when started on a single box, and the application is able to
put/get records without issue, and passes benchmarks/stress tests.
When we start the application on multiple nodes, with elasticsearch.yml
configured to allow the nodes to find each other via unicast, the cluster
comes up fine and goes green immediately. However, get requests randomly
start failing fairly quickly with a ClassCastException. Here is the
relevant part of the exception:
2013-05-13 16:37:35,597 ERROR New I/O worker #15 Hazelbridge - Exception in
ServerHandler java.lang.ClassCastException:
org.elasticsearch.common.bytes.ChannelBufferBytesReference cannot be cast
to org.elasticsearch.common.bytes.BytesArray
This exception occurs at the following call:
GetResponse g = client.prepareGet(esIndex, namespace, newString(key)).setFields(
"expiry","data").execute().actionGet();
if (g.isExists()) {
int exp = (int) g.getField("expiry").getValue();
BytesArray b = (BytesArray) g.getField("data").getValue(); //THIS LINE
CAUSES THE EXCEPTION
}
The value of exp is retrieved successfully and it can be logged to verify.
This doesn't happen for the first 3 or 4 puts, but then it starts happening
on 75% of gets. This does not happen in the single node case.
Help?
The mapping for the type is set up with the following code:
String mapping = jsonBuilder()
.startObject()
.startObject(ns)
.startObject("_ttl")
.field("enabled","true")
.endObject()
.startObject("_source")
.field("enabled","false")
.endObject()
.startObject("_all")
.field("enabled", "false")
.endObject()
.startObject("properties")
.startObject("data")
.field("type","binary")
.field("index","not_analyzed")
.field("store","yes")
.field("compress","false")
.endObject()
.startObject("expiry")
.field("type","integer")
.field("index","not_analyzed")
.field("store","yes")
.field("compress","false")
.endObject()
.endObject()
.endObject()
.string();
client.admin().indices().preparePutMapping(esIndex
).setType(ns).setSource(mapping).execute().actionGet();
--
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.