Allow index settings in Meta.index
See original GitHub issueCurrently, when defining a new DocType
you have to create a separate Index
object if you wish to configure any index-level settings. With the deprecation of multiple types in elasticsearch 6.0 it might make more sense to just allow the index settings to configurable on the DocType
itself in some fashion.
This would then allow even for situations where given DocType
is present in multiple indices (time-based indices for example) meaning its Meta.index
would specify a wildcard (products-*
for example) and provide settings which would then allow it to generate and save an IndeTemplate
and/or create any particular index via the init
classmethod.
Any ideas and feedback is more than welcome!
Inspired by @3lnc’s comment: https://github.com/elastic/elasticsearch-dsl-py/issues/779#issuecomment-350047587
Issue Analytics
- State:
- Created 6 years ago
- Comments:19 (11 by maintainers)
Top GitHub Comments
I absolutely agree that
Index
/DocType
distinction is no longer useful. What if we changed things around a bit, just brainstorming here so not all might make it to the target design or even make sense:DocType
toDocument
Meta
and._doc_type
init
and indexname
class Index:
as an (optional) section toDocument
that can contain definitions for:name
(can contain a wildcard)settings
/analyzers
my-idx-*
tomy-idx-2018.01.01
)template_name
if this definition if to be defined via a templaterollover
settingsIndex
object that will be accessible on theDocument
class (.index
??) which will:Index
classcreate
/create_template
/delete
/switch_alias
(by default point an alias to latest index in the group)/rollover
/shrink
/allocation
/…migrate
which will create a new index, reindex data from another index and swap aliasIf someone wants to have multiple
Document
classes stored in a single index, the recommended way would be to use inheritance and overrideMeta.matches
to dynamically determine which class to use for every hit returned. Question is how to then make sure the mappings get merged - I like the idea of aDocument
class iterating through all its subclasses and collecting mappings but it might be too confusing and dangerous so maybe we just do it explicitly somehow?What do you think?
#840 is ready for review and contains some examples showcasing some of the techniques made possible by this change