Signup/Sign In

[SOLVED] No handler for type [flattened] declared on field in Kibana 7.5.0

Posted in Cloud   LAST UPDATED: AUGUST 24, 2021

    If you are updating Kibana from an older version to Kibana 7.5.0 or newer, you may get this error when you try connecting Kibana with Elastcisearch service.

    Whenever we use Kibana and Elasticsearch service together, we must always make sure that we use the same version of both the service, and when we say same version, it is not just the version number but also the flavour of the service like default, basic, oss or production.

    Yes, the Elasticsearch and Kibana service comes in all these flavaours:

    1. default

    2. basic

    3. oss

    4. production

    and we must use the same version for both the Kibana and Elasticsearch service.

    Now, this is a general advice, but do we get the following error while using Kibana version 7.5.0 or above:


    '{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"No handler for type [flattened] declared on field [state]"}],"type":"mapper_parsing_exception",
    "reason":"Failed to parse mapping [_doc]: No handler for type [flattened] declared on field [state]",
    "caused_by":{"type":"mapper_parsing_exception","reason":"No handler for type [flattened] declared on field [state]"}},"status":400}'

    Root cause for Exception:

    The above exception is thrown when we are using the basic/default flavour of Kibana with Elasticsearch's oss flavour. You can verify the version of Elasticsearch that you are running by hitting the URL: http://<ELASTICSEARCH_URL>:9200 (use the IP address of your server running Elasticsearch or localhost if you are running it locally) and you will see a JSON output like this:


    {
    "name" : "elasticsearch-ab-op-01",
    "cluster_name" : "elasticsearch",
    "cluster_uuid" : "NygTh7657_uuOlNcx8uIh",
    "version" : {
    "number" : "7.5.0",
    "build_flavor" : "oss",
    "build_type" : "tar",
    "build_hash" : "unknown",
    "build_date" : "2020-07-06T09:41:09.176473Z",
    "build_snapshot" : false,
    "lucene_version" : "8.5.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
    },
    "tagline" : "You Know, for Search"
    }

    As you can see in the above JSON output, the value for build_flavor is oss, this means the Elasticsearch build flavor we are running is oss. Hence, we must use the oss version of Kibana too.

    If you are using AWS Elastcisearch service, the flattened field is available in the free Basic distribution that Elastic offers, but is not available in Amazon Elasticsearch

    What is the Fix?

    The fix is very simple if you see a difference between the build flavors of Kibana and Elasticsearch.

    If you are using docker image for Kibana using the URL similar to this: docker.elastic.co/kibana/kibana:7.5.0 then just change it to docker.elastic.co/kibana/kibana-oss:7.5.1 to start using the oss flavor of Kibana.

    Follow the same pattern for other versions too, just add -oss prefix and you should be good to go.

    But why does this happen?

    As the exception says - No handler for type [flattened] declared on field [state], this is because the Oss version and default version has different support for field types. So you can either downgrade to version previous to 7.5.0 for both Kibana and Elasticsearch or use the same build flavor for both.

    Some fieldttypes (like flattened are part of x-pack), with versions before 7.5.0 you should not have the problem at all, since the mapping that caused your issue was introduced by Lens in 7.5.0.

    The Kibana 7.5 non-OSS (basic) uses the flattened type available in the OSS version.

    The OSS version contains only features that are available under the Apache 2.0 license - https://www.elastic.co/subscriptions

    You can check it using GET _nodes API:


    {
    "name" : "flattened",
    "version" : "7.5.0",
    "elasticsearch_version" : "7.5.0",
    "java_version" : "1.8",
    "description" : "Module for the flattened field type, which allows JSON objects to be flattened into a single field.",
    "classname" : "org.elasticsearch.xpack.flattened.FlattenedMapperPlugin",
    "extended_plugins" : [
    "x-pack-core"
    ],
    "has_native_controller" : false
    },

    Conclusion:

    I hope this will solve your issue and now you also know the root cause of this issue. If you are setting up Kibana with Elasticsearch, we have multiple guides for this with Linux installation guide, Kubernetes Kibana Elasticsearch guide and Kibana & Elasticsearch with X-Pack security enabled, do check them out.

    If you still have any confusion or you are unable to fix your issue, do share it in the comment section below.

    You may also like:

    About the author:
    I like writing content about C/C++, DBMS, Java, Docker, general How-tos, Linux, PHP, Java, Go lang, Cloud, and Web development. I have 10 years of diverse experience in software development. Founder @ Studytonight
    Tags:KibanaElasticsearchHowTo
    IF YOU LIKE IT, THEN SHARE IT
     

    RELATED POSTS