Skip to content

Error deserializing co.elastic.clients.elasticsearch._types.analysis.Analyzer: Property 'type' not found #392

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

Closed
pasupathi-rajamanickam-odp opened this issue Sep 1, 2022 · 8 comments · Fixed by #522

Comments

@pasupathi-rajamanickam-odp
Copy link

pasupathi-rajamanickam-odp commented Sep 1, 2022

Java API client version

8.4.0

Java version

JDK-17

Elasticsearch Version

7.17.2

Problem description

Trying to read settings for an index, throwing Error deserializing co.elastic.clients.elasticsearch._types.analysis.Analyzer: Property 'type' not found Exception


var indexSetting = new GetIndicesSettingsRequest.Builder().index("index_1000").build();

try {
    var settings = elasticSearchClientConfig.getElasticsearchIndicesClient().getSettings(indexSetting);
    System.out.println(settings);
} catch(Exception e) {
    e.printStackTrace();
}

Settings

{
    "index_1000": {
        "settings": {
            "index": {
                "analysis": {
                    "analyzer": {
                        "edgengram-analyzer": {
                            "tokenizer": "edge_ngram_tokenizer"
                        }
                    }
                }
            }
        }
    }
}

Exception trace

Error deserializing co.elastic.clients.elasticsearch._types.analysis.Analyzer: Property 'type' not found (JSON path: index_1000.settings.index.analysis.analyzer['edgengram-analyzer']) (line no=1, column no=56407, offset=-1)
@pasupathi-rajamanickam-odp
Copy link
Author

@swallez Please help fixing this.

@marcreichman
Copy link

We've seen this as well in testing.

@bpenrod
Copy link

bpenrod commented Sep 16, 2022

This also happens for me with library versions 7.17.6 and 8.4.1 with the Get Index API, à la

client.indices().get(builder -> builder.index("*"))

It's a show-stopper for migrating to the Java Client, away from the RestHighLevelClient!

@rockwotj
Copy link

We're hitting this too in trying to migrate

@rockwotj
Copy link

rockwotj commented Oct 26, 2022

FYI I'm able to workaround this via the following (kotlin):

val unwrapped = DelegatingDeserializer.unwrap(Analyzer._DESERIALIZER) as ObjectDeserializer<*>
unwrapped.setTypeProperty("type", "custom")

EDIT: simpler

@pasupathi-rajamanickam-odp
Copy link
Author

FYI I'm able to workaround this via the following (kotlin):

            Analyzer._DESERIALIZER
                .let { DelegatingDeserializer.unwrap(it) }
                .let { DelegatingDeserializer.unwrap(it) }
                .let { unwrapped ->
                    unwrapped as ObjectDeserializer<*>
                    unwrapped.setTypeProperty("type", "custom")
                }

Don't know how to port this to Java, still looking...

@pasupathi-rajamanickam-odp
Copy link
Author

Work around Java version, thanks a ton @rockwotj

ObjectDeserializer unwrapped = (ObjectDeserializer) DelegatingDeserializer.unwrap(Analyzer._DESERIALIZER );
unwrapped.setTypeProperty("type", "custom");

@skyer9
Copy link

skyer9 commented Dec 28, 2022

or just add "type": "custom", to json.
even if it is default value, i really needs.

{
    "index_1000": {
        "settings": {
            "index": {
                "analysis": {
                    "analyzer": {
                        "edgengram-analyzer": {
                            "type": "custom",
                            "tokenizer": "edge_ngram_tokenizer"
                        }
                    }
                }
            }
        }
    }
}

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

Successfully merging a pull request may close this issue.

5 participants