Nested attachments struggle

Hi there,

I'm having a (very) hard time mapping and indexing nested attachments. What I have so far:

Elasticsearch vesion: 5.5

Mapping:

{
    "mappings": {
        "entry": { 
            "properties": { 
                "id": { "type": "integer" }, 
                "title": { "type": "string" }, 
                "attachments": { 
                    "type" : "nested",
                    "properties": {
                        "attachment" : {
                            "type" : "attachment",
                            "fields" : {
                              "content" : { "index" : true },
                              "title" : { "store" : true },
                              "date" : { "store" : true },
                              "keywords" : { "store" : true },
                              "content_type" : { "store" : true },
                              "content_length" : { "store" : true },
                              "language" : { "store" : true }
                            }
                        }
                    }
                }
            }
        }
    }
}

Then I try to index a new entry using:

POST myindex/entry
{  
    "id": 1,
    "title": "Title here",
    "attachments": [
        {
            "content": "JVBERi0xLjcKJeLjz9....YKJSVFT0YK"
        } 
    ] 
}

It results in the error:

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "object mapping [attachments] can't be changed from nested to non-nested"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "object mapping [attachments] can't be changed from nested to non-nested"
    },
    "status": 400
}

What obvious thing am I missing here? Since the struggle is so hard and searching doesn't bring back much interesting results, it must be something simple right?

Mapper attachment plugin is deprecated.

Use ingest attachment instead.

Thanks for your reply. Appreciated. I didn't understood this from the (wealth) of documentation and Google searches. If I'd read with more attention I might have :slight_smile:. But for me it was easily missed.

Sorry you missed it. We tried to make big but sometimes big is too big :smiley:

I think but unsure though that mapper attachments should log something in the deprecated logger if activated. But nothing obvious for sure.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.