Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

406 Content-Type header [application/vnd.elasticsearch+json;compatible-with=8] is not supported #8112

Closed
langhaoabcd opened this issue Apr 10, 2024 · 3 comments
Labels
8.x Relates to 8.x client version Category: Not an issue

Comments

@langhaoabcd
Copy link

langhaoabcd commented Apr 10, 2024

//Elastic.Clients.Elasticsearch: 8.13.5
var nameValueCollection = new NameValueCollection
{
    { "Content-Type", "application/json" }
};
var settings = new ElasticsearchClientSettings(new Uri(ES_URL))
                 .GlobalHeaders(nameValueCollection)
                .Authentication(new BasicAuthentication(ES_NAME, ES_PWD))
                .EnableDebugMode();
var elasticsearchClient = new ElasticsearchClient(settings);

var idsQuery = new IdsQuery();
idsQuery.Values = new Ids(new[] { "46016822" });
var response = await elasticsearchClient.DeleteByQueryAsync(new DeleteByQueryRequest("test_saas_index")
{
    Query = idsQuery
});

Invalid Elasticsearch response built from a unsuccessful (406) low level call on POST: /test_saas_index/_delete_by_query?pretty=true&error_trace=true
Exception: Request failed to execute. Call: Status code 406 from: POST /test_saas_index/_delete_by_query?pretty=true&error_trace=true. ServerError: Type: Reason: "Content-Type header [application/vnd.elasticsearch+json;compatible-with=8] is not supported"

Audit trail of this API call:

OriginalException: Elastic.Transport.TransportException: Request failed to execute. Call: Status code 406 from: POST /test_saas_index/_delete_by_query?pretty=true&error_trace=true. ServerError: Type: Reason: "Content-Type header [application/vnd.elasticsearch+json;compatible-with=8] is not supported"

Request:

{
"query": {
"ids": {
"values": [
"46016822"
]
}
}
}

Response:

{
"error" : "Content-Type header [application/vnd.elasticsearch+json;compatible-with=8] is not supported",
"status" : 406
}

TCP states:

Established: 87
TimeWait: 14
CloseWait: 19

ThreadPool statistics:

Worker:
Busy: 0
Free: 32767
Min: 8
Max: 32767
IOCP:
Busy: 0
Free: 1000
Min: 8
Max: 1000

@langhaoabcd langhaoabcd added 8.x Relates to 8.x client version Category: Bug labels Apr 10, 2024
@flobernd
Copy link
Member

Hi @langhaoabcd, what is the server version you are trying to connect to?

@langhaoabcd
Copy link
Author

langhaoabcd commented Apr 11, 2024

@flobernd Its Elasticsearch Clusters Version 7.4.0, but querying a single data is successful using method GetAsync(),multiple ids value using SearchAsync()/DeleteByQueryAsync unsuccessful

@flobernd
Copy link
Member

Hi @langhaoabcd,

using the 8.x client on a 7.x cluster is not supported. Please check the version compatibility matrix on the README. You have to upgrade your cluster to 8.x or use NEST 7.17.

Some requests without a body might work, but the majority won't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to 8.x client version Category: Not an issue
Projects
None yet
Development

No branches or pull requests

2 participants