Error deserializing co.elastic.clients.elasticsearch._types.analysis.CharFilterDefinition: Unknown 'type' value: 'stconvert'

Open
#519 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
elasticsearch, java
Domain
search

Research direction

Start by tracing CharFilterDefinition, CharFilterDefinitionVariant, and CharFilterDefinition.Kind, then compare their handling with HtmlStripCharFilter. Determine whether the client has an established path for plugin-provided char-filter types; done should be a documented, tested way to serialize the stconvert definition or a clear limitation if custom types cannot be supported.

Written by the indexing model from the issue text.

Description

Description

I am trying to create an index using a java client, and I have installed the stconvert plugin in the elasticsearch cluster (a plugin that provides replacement for both traditional and simplified Chinese), and I am getting this error during the index creation process.

My code implementation:

Reader stconvertJson = new StringReader(
                "{\"type\":\"stconvert\",\"delimiter\":\"#\",\"keep_both\":false,\"convert_type\":\"t2s\"}");
Map<String, CharFilter> charFilterMap = new HashMap<>();
        charFilterMap.put("tsconvert", new CharFilter.Builder()
                .definition(new CharFilterDefinition.Builder().withJson(stconvertJson).build()).build());

CreateIndexRequest c = new CreateIndexRequest.Builder()
                    .index(index)
                    .aliases(aliases, a -> a
                            .isWriteIndex(true))
                    .settings(s -> s
                            .analysis(a -> a
                                    .charFilter(charFilterMap)  //this
                                    .filter(filterMap)
                                    .tokenizer(tokenizerMap)
                                    .analyzer(analyzerMap))
                            .numberOfShards("1")
                            .numberOfReplicas("1"))
                    .mappings(typeMapping)
                    .build();
            createIndexResponse = elasticClient.indices().create(c);

found that this is not feasible, and also in order to be able to pass serialization, I also tried to implement CharFilterDefinitionVariant to do it, similar to HtmlStripCharFilter, but eventually failed because CharFilterDefinition.Kind could not satisfy me.

So I was wondering if elasticsearch has additional plugins to build index in the java client, how should I go about doing that or inherit the implementation code?

Dominant language
Java
Stars
524
Forks
300
Avg merge
1d 11h
Merged PRs (30d)
16

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.

More from elastic/elasticsearch-java

All issues in elastic/elasticsearch-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.