Skip to content

Java API Client 8.x SettingsSimilarity doesnt have field 'type' for CreateIndexRequest API #366

Closed
@notrickyd

Description

@notrickyd

Java API client version

8.3.3

Java version

17

Elasticsearch Version

8.3.3

Problem description

 new CreateIndexRequest.Builder().
        .settings(s -> s
                .similarity(
                    new SettingsSimilarity.Builder().lmj(
                        new SettingsSimilarityLmj.Builder()
                            .lambda(2)
                            .build()
                    ).build()
                )

Response from Elasticsearch is:
[es/indices.create] failed: [illegal_argument_exception] Similarity [lmj] must have an associated type

This is the same error received from Elasticsearch when you run REST api with JSON:

PUT /index
{
  "settings": {
     "similarity": {
        "lmj": {
           "lambda": 2
        }
      }
   }  
}

And there is no possibility to write custom similarities or specify wanted field type in existing ones. As well as you cannot specify similarity-name with this Java API.

This issue starts from 8.0.1 till 8.3.3 (current). In earlier versions there are no SimilarityXXX classes at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: SpecificationRelated to the API spec used to generate client code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions