opensearch-project / opensearch-project/opensearch-java

Analyzer.Kind to support all languages for analyzers

Open
#684 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
165
Forks
250
Avg merge
1d 18h
Merged PRs (30d)
26

Description

Is your feature request related to a problem?

When trying to build a client using json files, when deserialising the settings, I get the error
Missing required property 'Builder.<variant kind>'.
This is an example of a settings that will fail:
{ "index": { "analysis": { "analyzer": { "english_analyzer": { "type": "english", "char_filter": [ "html_strip" ], "tokenizer": "standard" } } } } }

The problem is that Analyzer.Kind does not support most languages. Actually only Dutch is listed in the enum.
Analyzer source code

The problem is that

Not able to build the client using analyzers type for languages other than Dutch

What solution would you like?

Add all other languages listed here

What alternatives have you considered?

Using a different client.

Do you have any additional context?

All the necessary info is already mentioned above.
here is a sample test that will fail with org.opensearch.client.util.MissingRequiredPropertyException: Missing required property Builder.<variant kind>

   @Test
    public void testParsingAnalyzer() {

        JsonpMapper mapper = new JsonbJsonpMapper();
        String json = "{ \"index\": { \"analysis\": { \"analyzer\": { \"some_analyzer\": { \"type\": \"english\", \"char_filter\": [ \"html_strip\" ], \"tokenizer\": \"standard\" } } } } } ";

        JsonParser parser = mapper.jsonProvider().createParser(new StringReader(json));
        IndexSettings indexSettings = IndexSettings._DESERIALIZER.deserialize(parser, mapper);
        assertTrue(true);
    }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in java-client/src/main/java/org/opensearch/client/opensearch/_types/analysis/Analyzer.java and run the sample test using IndexSettings._DESERIALIZER with the English analyzer JSON. Compare Analyzer.Kind with the language analyzers listed in the linked OpenSearch documentation; done means those language analyzer types deserialize without MissingRequiredPropertyException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.