ES 5.1.X - REST API with SearchSourceBuilder bug?

I'm using the following in my Java project.

<!-- https://mvnrepository.com/artifact/org.elasticsearch.client/rest -->
<dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>rest</artifactId>
    <version>5.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch -->
<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>5.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.elasticsearch.client/transport -->
<dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>transport</artifactId>
    <version>5.1.1</version>
</dependency>

I'm using SearchSourceBuilder to build a query, which I then execute against the new REST API.

Specifically, I'm running a count query .../_count. The problem is that SearchSourceBuilder generates this as part of the query: { ..., ext:{} } which is not allows for /_count queries.

There seems to be no way to disable the generation of this field (null not allowed):

public SearchSourceBuilder ext(List<SearchExtBuilder> searchExtBuilders) {
    this.extBuilders = Objects.requireNonNull(searchExtBuilders, "searchExtBuilders must not be null");
    return this;
}

Is this a bug? Am I missing something? Or is there another preferred way to generate the queries?

Thanks,
Erik

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.