Skip to content

I can't provide a set of synonyms when creating the analyzer #781

Closed
@powfyy

Description

@powfyy

Java API client version

8.13.2

Java version

17

Elasticsearch Version

8.12.2

Problem description

Hello, I read in the documentation: "Use synonyms_set configuration option to provide a synonym set created via Synonyms Management APIs:", but the SynonymGraphTokenFilter class does not have a corresponding field, there are only synonyms (String) and synonymsPath. How can I provide a set of synonyms?

private final ElasticsearchClient client;

client.indices().create(
        new CreateIndexRequest.Builder()
          .index(INDEX_PREFIX + "_" + name)
          .settings(new IndexSettings.Builder()
            .numberOfShards(SHARDS)
            .numberOfReplicas(REPLICAS)
            .analysis(new IndexSettingsAnalysis.Builder()
              .analyzer("search_analyzer", new Analyzer.Builder()
                .custom(new CustomAnalyzer.Builder()
                  .tokenizer("standard")
                  .filter("synonym_graph")
                  .build())
                .build())
              .filter("synonym_graph", new TokenFilter.Builder()
                .definition(new TokenFilterDefinition.Builder()
                  .synonymGraph(new SynonymGraphTokenFilter.Builder()
                    
                    .updateable(true)
                    .build())
                  .build())
                .build())
              .build())
            .build())
          .build()
      );

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