Nested attachments struggle


(Rutger Heijmerikx) #1

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?


(David Pilato) #2

Mapper attachment plugin is deprecated.

Use ingest attachment instead.


(Rutger Heijmerikx) #3

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.


(David Pilato) #4

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.


(system) #5

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