Closed switowski closed 8 years ago
Is there an explicit "settings" key generated? Normally DoMapping generates the content of the type mapping corresponding to the given JSON Schema. The idea is that it can also be used manually like this:
PUT myindex/_mapping/mydoctype
{
"properties": {
"name": {
"type": "string"
}
}
}
If DoMapping was adding enclosing "mappings" or "settings" it could not be used like that anymore. There is also the issue that DoMapping cannot know how you want to name the doctype.
In order to set all the mappings in one request, the recommended solution is to use a jinja template including all the type mappings into one global index "mappings" file. This is more extensible as you might want to add later other doctypes to the mappings.
After some discussion with @JavierDelgadoFernandez, it would be possible to add some options to the CLI when generating the mapping from the JSON Schema. These options would add enclosing document type and mappings
dictionaries. The one adding the document type should take the document type name as argument.
This will be useful for cases when multiple indexes with only one document type are created. Analysis preservation is one of these use cases.
As reported by @JavierDelgadoFernandez, domapping is putting ElasticSearch mappings under
settings
key in the generated file, while they should go insidemappings
key.