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)
Mr. Welsch, error resolved, Got an output.
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.
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 ...
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.