Elasticsearch : NoSuchFieldError

I'm beginner to Elasticsearch using version-2.3.5 Jackson lib jackson-core-2.6.6.jar and jackson-dataformat-smile-2.6.6.jar
Code: QueryBuilder qb = QueryBuilders.rangeQuery("timestamp").from("2016-08-03 12:03:06").to("2016-08-03 14:09:58");
SearchResponse sResponse=client.prepareSearch("jsonlogpage")
.setTypes("logs")
.setQuery(qb)
//.execute().actionGet(); ( I've used execute().actionGet() and get() also, always error shows in this line)
.get();

Error:
Exception in thread "main" java.lang.NoSuchFieldError: FAIL_ON_SYMBOL_HASH_OVERFLOW
at org.elasticsearch.common.xcontent.smile.SmileXContent.(SmileXContent.java:46)
at org.elasticsearch.common.xcontent.XContentFactory.contentBuilder(XContentFactory.java:124)
at org.elasticsearch.action.support.ToXContentToBytes.buildAsBytes(ToXContentToBytes.java:62)
at org.elasticsearch.action.search.SearchRequest.source(SearchRequest.java:250)
at org.elasticsearch.action.search.SearchRequestBuilder.beforeExecute(SearchRequestBuilder.java:1027)
at org.elasticsearch.action.search.SearchRequestBuilder.beforeExecute(SearchRequestBuilder.java:50)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:86)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:56)
at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:64)
at com.example.restexpkg.NetClientPost.main(NetClientPost.java:80)

How can I resolve this error?

Are you sure you don't have an older jackson-core dependency on your classpath?

Ya I'm sure.. i have these 2 jackson lib only

are you using maven?

can you give the output of mvn dependency:tree

Im not using Maven. Just build in Java API

any other libraries on the classpath?

These are the other libraries:

com.fasterxml.jackson.core.jar
commons-cli-1.3.1.jar
commons-math3-3.1.jar
elasticsearch-2.3.5.jar
gauva-18.0.jar
hppc-0.7.1.jar
jackson-core-2.6.6.jar
jackson-dataformat-smile-2.6.6.jar
java-json.jar
joda-time-2.9.4.jar
jsr166e-1.1.0.jar
lucene-core-5.5.0.jar
netty-3.10.5.Final.jar
t-digest-3.0.jar

Is there any other lib to be added? Why do I have error in searchResponse ....... .execute().actionGet() / .get()?

I've referred this link

see, you have two jackson core versions there:

com.fasterxml.jackson.core.jar

and

jackson-core-2.6.6.jar

thnq for pointing. Which 1 should I delete?

As per errors, ive added libraries.. i didnt notice it.

at least jackson-core-2.6.6.jar seems to be the one with the right version, so I would remove com.fasterxml.jackson.core.jar

1 Like

Mr. Welsch, error resolved, Got an output. :raised_hands:
thank you so much for your instant reply.
I wish to say 1000 thanks..
Took more than 1/2 a day to resolve it.

If you can, kindly prefer some material to learn elasticsearch. being a beginner, im struggling to resolve even a small prb.

The "Definitive Guide" is definitely a good (but long) read:

https://www.elastic.co/guide/en/elasticsearch/guide/2.x/index.html

Thank you Yannick

I'm using regex to read a log file. I need to take a record as per date range. So I use Querybuilder. Where should I write this queryBuiler whether before/inside Matcher or before saving into elasticsearch.

class Class1{
void readEntries(){
Pattern p = Pattern.compile(regexpattern);
Matcher matcher= p.matcher(logline);

if(matcher.find()) {
/* QueryBuilder qb = QueryBuilders.rangeQuery("timestamp").from("2016-08-03 12:03:06").to("2016-08-03 14:09:58");
SearchResponse sResponse=client.prepareSearch("jsonlogpage")
.setTypes("logs")
.setQuery(qb)
.get(); */
//---------------Should i write QB here?
obj.setTimestamp(matcher.group(1));
......
}
//-----------------or can i write here?
}

void persist(){
//HTTPUrlConnection....
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
//------------Should I write QB here?
String jsonStr = mapper.writeValueAsString(entry);
System.out.println(jsonStr);
//----------------Should I write QB her

OutputStream os = conn.getOutputStream();
os.write(jsonStr.toString().getBytes("UTF-8"));

// --------------should i write here?
BufferedReader ...

}
}

If not, where should i write this QB?