Skip to content

[es/count] failed: [illegal_argument_exception] request [/p7/_count] contains unrecognized parameter: [q] #924

Closed
@koderBoy

Description

@koderBoy

Java API client version

8.8.2

Java version

OpenJDK Runtime Environment (Temurin)(build 1.8.0_422-b05)

Elasticsearch Version

8.8.2

Problem description

 public static void main(String[] args) throws IOException {

        HttpHost httpHost = HttpHost.create("http://127.0.0.1:9200");
        RestClientBuilder restClientBuilder = RestClient.builder(httpHost);
        restClientBuilder.setHttpClientConfigCallback(httpAsyncClientBuilder -> {
            BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
            credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", "elas!@#"));
            httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
            return httpAsyncClientBuilder;
        });

        ElasticsearchClient client = new ElasticsearchClient(new RestClientTransport(restClientBuilder.build(),new JacksonJsonpMapper()));

        CountResponse count = client.count(req->req.index("p7").q("docNo:*"));
        System.out.println(count.count());
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions