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?