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

Analyzer.Kind to support all languages for analyzers #684

Open
brentam opened this issue Oct 24, 2023 · 3 comments
Open

Analyzer.Kind to support all languages for analyzers #684

brentam opened this issue Oct 24, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@brentam
Copy link
Contributor

brentam commented Oct 24, 2023

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);
    }
@brentam brentam added enhancement New feature or request untriaged labels Oct 24, 2023
@dblock
Copy link
Member

dblock commented Dec 4, 2023

@brentam Want to try to contribute a fix for it? Feels like at least you should be able to specify an arbitrary analyzer without constantly having to expand the enumeration.

@dblock dblock removed the untriaged label Dec 4, 2023
@brentam
Copy link
Contributor Author

brentam commented Dec 21, 2023

@dblock hi, I will try to contribute when I have some time, I probably will add all the missing languages. That would be enough for this case.

@brentam
Copy link
Contributor Author

brentam commented Dec 21, 2023

Created PR: #779 to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants