I have a mapping definition with multiple object types that looks like:
{
"mappings": {
"_doc": {
"properties": {
"identifier": {
"type": "object",
"properties": {
"id": {
"type": "keyword"
},
"upstream": {
"type": "keyword"
}
}
},
"document": {
"type": "object",
"properties": {
"engine": {
"type": "keyword"
},
"content": {
"type": "text"
}
}
}
}
}
}
}
This will build fields: identifier.id, identifier.upstream, document.engine, and document.query. I would like to allow additional mappings for the "root" fields e.g. the plain "identifier" and "document" field.
For the "identifier" field I would like to be able to search across all subfields (without requiring users to specify "identifier.*") which I believe should be a simple keyword type with all subfields specifying: "copy_to": "identifier". Likewise, for the "document" field I would like to set it up as an alias field which will point to populated "document.content" field. I tried updating the "type" to the desired field types but was unable to create the index, can someone please let me know if this is achievable.
Update:
I also tried to flatten out the structure myself and do:
"properties": {
"identifier": {
"type": "keyword"
},
"identifier.id": {
"type": "keyword",
"copy_to": "identifier"
},
"identifier.upstream": {
"type": "keyword",
"copy_to": "identifier"
},
"document": {
"type": "alias",
"path": "document.content"
},
"document.engine": {
"type": "keyword"
},
"document.content": {
"type": "text"
}
}
But received the following error:
Failed to parse mapping [_doc]: Can't merge a non object mapping [document] with an object mapping [document]