ElasticsearchStatusException contains unrecognized parameter: [ccs_minimize_roundtrips]]]
Asked Answered
X

4

14

I am trying to do a simple search on ElasticSearch server and getting teh following error

ElasticsearchStatusException[Elasticsearch exception [type=illegal_argument_exception, reason=request [/recordlist1/_search] contains unrecognized parameter: [ccs_minimize_roundtrips]]]

The query String : {"query":{"match_all":{"boost":1.0}}}

I am using : elasticsearch-rest-high-level-client (maven artifact)

SearchRequest searchRequest = new SearchRequest(INDEX);
        
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(QueryBuilders.matchAllQuery());
        searchRequest.source(searchSourceBuilder);
        
        try 
        {
            
            
            System.out.print(searchRequest.source());
            SearchResponse response = getConnection().search(searchRequest,RequestOptions.DEFAULT);
            SearchHit[]  results=response.getHits().getHits();
            for(SearchHit hit : results)
            {
                String sourceAsString = hit.getSourceAsString();
                System.out.println( gson.fromJson(sourceAsString, Record.class).year);
            }
            
        } 
        catch(ElasticsearchException e) 
        {
            e.getDetailedMessage();
            e.printStackTrace();
        } 
        catch (java.io.IOException ex)
        {
            ex.getLocalizedMessage();
            ex.printStackTrace();
        }
Xanthochroism answered 9/4, 2019 at 22:50 Comment(1)
What version of ES are you running and what version of the ES client are you using? It seems you're mixing version 7 vs another one, but unsure which one.Neelon
M
8

This usually occurs on porting from elastic-search version 6.X.X to 7.X.X.

You should reduce the elastic-search version to 6.7.1 and try running it.

Since you are using maven you should make sure your dependencies should be like:

<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>6.7.1</version>
</dependency>
Mylohyoid answered 12/4, 2019 at 13:36 Comment(6)
This is not a valid solution when you really want to work with ElasticSearch 7.X.XO
@O That's true. This just points out a possible scenario. I fixed it by reducing the version. This will work especially for people unnecessarily jumping to 7.X.XMylohyoid
How do I upgrade from 6.1.1 to 7.3.0 then? The rolling upgrade is supported from 5.6 -> 6.8. Then 6.8 -> 7.3. Do I upgrade ES first then REST package? Or vice versa? Note: 6.1.1 has the stupid bug where _doc cannot be used as "type"; therefore, I am currently using "doc" as the "type".Discerning
Yeah. Moving from <v7.X.X to >= v7.X.X is kind of tough. This is because there are many breaking changes from 6.x.x to 7.x.x Hopefully your application is layered and has some kind of dependency injection. This way you could slowly start converting some APIs like search first, then update, etc.Mylohyoid
Also, afair 'type' is not supported after 6.x.xMylohyoid
The question is to keep your client's version compatible with the elastic search version, in my case I was using version 7.xx on the client to run the query and the error happened, as I cannot change my client I upgraded of elasticsearch.Neomineomycin
C
2

I ran into this same issue when i had by mistake my 6.5 cluster still running while using the 7.2 API. Once I started up my 7.2 cluster the exception went away.

Canvass answered 19/10, 2019 at 3:39 Comment(0)
L
2

Maybe you can find this from stackTrace of exception:

Suppressed: org.elasticsearch.client.ResponseException: method [POST], host [http://127.0.0.1:9200], URI [/recordlist1/_search?rest_total_hits_as_int=true&typed_keys=true&ignore_unavailable=false&expand_wildcards=open%2Cclosed&allow_no_indices=true&ignore_throttled=false&search_type=query_then_fetch&batched_reduce_size=512], status line [HTTP/1.1 400 Bad Request]

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"request [/_search] contains unrecognized parameters: [ignore_throttled], [rest_total_hits_as_int]"}],"type":"illegal_argument_exception","reason":"request [/_search] contains unrecognized parameters: [ignore_throttled], [rest_total_hits_as_int]"},"status":400}

So, You can try this GET method by curl, which come to the same error message.

curl -XGET http://127.0.0.1:9200/recordlist1/_search?rest_total_hits_as_int=true&typed_keys=true&ignore_unavailable=false&expand_wildcards=open%2Cclosed&allow_no_indices=true&ignore_throttled=false&search_type=query_then_fetch&batched_reduce_size=512

I've tried delete 'rest_total_hits_as_int=true' ... Case Closed.

You should check your es-server's version by elasticsearch -V and client’s version in maven.

In high-level client, they add rest_total_hits_as_int=true by default, and I find no access to set it to false.

you can refer to

org.elasticsearch.client.RequestConverters#addSearchRequestParams Line:395 <v6.8.10> 

I had no other choice but matching client to match server.

Why it's so Exciting ? ehn... after all, it is "High Level".

Lien answered 30/7, 2020 at 3:29 Comment(0)
H
2

Problem here is the movement of version, probably you were using elastic search 6.x.x and now using 7.x.x

You can definitely solve this by having your elastic search server of 7.x.x.

Elasticsearch 6.x.x used to have type of document 
(where you could give type to your documents)


but Elasticsearch 7.x.x onwards it has no type or 
default type _doc, so you need to have _doc as your type 
while creating mapping.
Helles answered 30/7, 2020 at 4:4 Comment(2)
So, we can still have Elasticsearch 6.x.x server with document type as _doc and import Client caller package 7.x.xTerpstra
I think you can, give it a try, if both named _doc it should allow.Helles

© 2022 - 2024 — McMap. All rights reserved.