Search code examples
elasticsearchelasticsearch-pluginelasticsearch-7

Mapping attachment is throwing the error in Elasticsearch 7.7


I try to map the field as user defined field - "attachment" in elastic search like below

"file": {
            "type": "attachment",
            "fields": {
              "content": {
                "type": "text"
              },
              "author": {
                "type": "text",
                "store": true
              }
}

Attachment mapping like below,

"attachment": {
            "properties": {
              "author": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              "content": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }

But I am getting the following error :

java.util.concurrent.ExecutionException: RemoteTransportException[[3cfb4e163654][172.17.0.2:9300][indices:admin/create]]; nested: MapperParsingException[Failed to parse mapping [mappings]: No handler for type [attachment] declared on field [file]]; nested: MapperParsingException[No handler for type [attachment] declared on field [file]];

[Failed to parse mapping [mappings]: No handler for type [attachment] declared on field [file]]

I already have the ingest attachment plugin added to the elastic search plugin and it is available when I list the plugin in elastic search.

What is wrong with my mapping?

Please help me on this ?

Thanks,
Harry


Solution

  • You have installed the plugin and it is available when you list it. But you are getting the error No handler for type [attachment] declared on field [file]

    Reason:

    You are expecting to add attachment as a type. But that's not true.

    Ingest attachment plugin does not add a new type. But adds an ingest processor

    Reference

    You need to add this as a processor in your pipeline.

    Update1:

    Just installing the plugin will not solve the problem as it is invalid type. I am able to reproduce this error.

    Reference Documentation is the above link is the one which I attached in the original answer.

    Nice explanation about the way of usage