0

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

Harry
  • 3,072
  • 6
  • 43
  • 100

1 Answers1

0

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

Gibbs
  • 21,904
  • 13
  • 74
  • 138
  • If I understand correctly, After installing the plugin, I don't need to do the mapping rather I just want to set pipeline like this : https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-ingest-put-pipeline.html Am I correct? – Harry Jun 24 '20 at 11:57
  • 1
    Yes, you need to set the pipeline. You can use that for java. – Gibbs Jun 24 '20 at 12:17
  • https://stackoverflow.com/questions/62671455/elasticsearch-put-role-api Could you check this pls – Harry Jul 01 '20 at 07:20
  • Thanks @Gibbs, Any luck on getting this? – Harry Jul 02 '20 at 04:50