While connecting elasticSearch Getting this Exception through java api

SLF4J: Failed toString() invocation on an object of type [org.elasticsearch.search.builder.SearchSourceBuilder]
Reported exception:
java.lang.NullPointerException
	at org.elasticsearch.index.query.BoolQueryBuilder.doXArrayContent(BoolQueryBuilder.java:274)
	at org.elasticsearch.index.query.BoolQueryBuilder.doXContent(BoolQueryBuilder.java:258)
	at org.elasticsearch.index.query.AbstractQueryBuilder.toXContent(AbstractQueryBuilder.java:87)
	at org.elasticsearch.index.query.BoolQueryBuilder.doXArrayContent(BoolQueryBuilder.java:274)
	at org.elasticsearch.index.query.BoolQueryBuilder.doXContent(BoolQueryBuilder.java:256)
	at org.elasticsearch.index.query.AbstractQueryBuilder.toXContent(AbstractQueryBuilder.java:87)
	at org.elasticsearch.common.xcontent.XContentBuilder.value(XContentBuilder.java:859)
	at org.elasticsearch.common.xcontent.XContentBuilder.value(XContentBuilder.java:852)
	at org.elasticsearch.common.xcontent.XContentBuilder.field(XContentBuilder.java:844)
	at org.elasticsearch.search.builder.SearchSourceBuilder.innerToXContent(SearchSourceBuilder.java:1295)
	at org.elasticsearch.search.builder.SearchSourceBuilder.toXContent(SearchSourceBuilder.java:1432)
	at org.elasticsearch.common.xcontent.XContentHelper.toXContent(XContentHelper.java:408)
	at org.elasticsearch.search.builder.SearchSourceBuilder.toString(SearchSourceBuilder.java:1689)
	at org.elasticsearch.search.builder.SearchSourceBuilder.toString(SearchSourceBuilder.java:1684)
	at org.slf4j.helpers.MessageFormatter.safeObjectAppend(MessageFormatter.java:277)
	at org.slf4j.helpers.MessageFormatter.deeplyAppendParameter(MessageFormatter.java:249)
	at org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:211)
	at org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:161)
	at ch.qos.logback.classic.spi.LoggingEvent.getFormattedMessage(LoggingEvent.java:293)
	at ch.qos.logback.classic.spi.LoggingEvent.prepareForDeferredProcessing(LoggingEvent.java:206)
	at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:223)
	at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:102)
	at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:84)
	at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)
	at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:270)
	at ch.qos.logback.classic.Logger.callAppenders(Logger.java:257)
	at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)
	at ch.qos.logback.classic.Logger.filterAndLog_1(Logger.java:398)
	at ch.qos.logback.classic.Logger.debug(Logger.java:486)

Simply posting an excerpt of a log file isn't going to allow anyone to help you unfortunately, please provide more information.


this is the code i am getting this exception

if i hit that api continuously i am getting the above exception

    SearchSourceBuilder srchSrc = ESQueryHelper.buildSearchSource(0, query,Arrays.asList(aggs));
            LOGR.debug("Query: {}", srchSrc);
            SearchRequest req = (new SearchRequest(new String[]{CustomerESQueryHelper.getIndexName(dto.getProgId())})).source(srchSrc);

in the first hit getting the proper response from elasticSearch in if i hit continuously getting this exception

Please don't post pictures of text, logs or code. They are difficult to read, impossible to search and replicate (if it's code), and some people may not be even able to see them :slight_smile:

I am receiving an ActionRequestValidationException:invalid path when continuously hit
requests through the Java API. or else i am getting the above exception

please help me