elastic / elasticsearch-net

This strongly-typed, client library enables working with Elasticsearch. It is the official client maintained and supported by Elastic.
https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index.html
Apache License 2.0
13 stars 1.15k forks source link

"Unknown analyzer type [language]" when creating an index with a language analyzer #7739

Open LionelVallet opened 1 year ago

LionelVallet commented 1 year ago

Elastic.Clients.Elasticsearch version: 8.1.1

Elasticsearch version: 8.7.1

.NET runtime version: 7.0.5

Operating system version: Debian 11

Description of the problem including expected versus actual behavior: When I create an index with a language analyzer specified, Elasticsearch throws a bad request error :

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Unknown analyzer type [language] for [default]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Unknown analyzer type [language] for [default]"
  },
  "status": 400
}

Steps to reproduce:

await elasticsearchClient.Indices.CreateAsync<JobOffer>(r => r
                        .Settings(s => s
                            .Analysis(a => a
                                .Analyzers(az => az
                                    .Language("default", la => la
                                        .Language(Language.French))))));

Expected behavior Index is created

DebugInformation:

# FailureReason: BadResponse while attempting PUT on https://elasticsearch01:9200/joboffers?pretty=true&error_trace=true
# Audit trail of this API call:
 - [1] BadResponse: Node: https://elasticsearch01:9200/ Took: 00:00:00.7313191
# OriginalException: Elastic.Transport.TransportException: Request failed to execute. Call: Status code 400 from: PUT /joboffers?pretty=true&error_trace=true. ServerError: Type: illegal_argument_exception Reason: "Unknown analyzer type [language] for [default]"
   at Elastic.Transport.DefaultHttpTransport`1.HandleTransportException(RequestData data, Exception clientException, TransportResponse response)
   at Elastic.Transport.DefaultHttpTransport`1.FinalizeResponse[TResponse](RequestData requestData, RequestPipeline pipeline, List`1 seenExceptions, TResponse response)
   at Elastic.Transport.DefaultHttpTransport`1.RequestAsync[TResponse](HttpMethod method, String path, PostData data, RequestParameters requestParameters, CancellationToken cancellationToken)
   at Elastic.Clients.Elasticsearch.ElasticsearchClient.<>c__DisplayClass40_0`3.<<DoRequestAsync>g__SendRequest|0>d.MoveNext() in /_/src/Elastic.Clients.Elasticsearch/Client/ElasticsearchClient.cs:line 381
--- End of stack trace from previous location ---
# Request:
{
  "settings": {
    "analysis": {
      "analyzer": {
        "default": {
          "language": "French",
          "type": "language"
        }
      }
    }
  }
}
# Response:
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "Unknown analyzer type [language] for [default]",
        "stack_trace" : "org.elasticsearch.ElasticsearchException$1: Unknown analyzer type [language] for [default]\n\tat org.elasticsearch.server@8.7.1/org.elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:668)\n\tat org.elasticsearch.server@8.7.1/org.elasticsearch.ElasticsearchException.generateFailureXContent(ElasticsearchException.java:596)\n\tat org.elasticsearch.server@8.7.1/org.elasticsearch.rest.RestResponse.build(RestResponse.java:175)\n\tat org.elasticsearch.server@8.7.1/org.elasticsearch.rest.RestResponse.<init>(RestResponse.java:123)\n\tat org.elasticsearch.server@8.7.1/org.elasticsearch.rest.RestResponse.<init>(RestResponse.java:102)\n\tat org.elasticsearch.server@8.7.1/org.elasticsearch.rest.action.RestActionListener.onFailure(RestActionListener.java:55)\n\tat org.elasticsearch.server@8.7.1/org.elasticsearch.client.internal.node.NodeClient$SafelyWrappedActionListener.onFailure(NodeClient.java:170)\n\tat org.elasticsearch.server@8.7.1/org.elasticsearch.tasks.TaskManager$1.onFailure(TaskManager.java:218)\n\tat org.elasticsearch.server@8.7.1/org.elasticsearch.action.support.ContextPreservingActionListener.onFailure(ContextPreservingActionListener.java:38)\n\tat org.elasticsearch.server@8.7...
codingdockk commented 1 year ago

I'm having the same issue with elasticsearch client 8 version.