Skip to content

Instantly share code, notes, and snippets.

@honzakral
Created April 15, 2016 17:44
Show Gist options
  • Save honzakral/aa03d4d8270552b4053d671fc6ccd7e1 to your computer and use it in GitHub Desktop.
Save honzakral/aa03d4d8270552b4053d671fc6ccd7e1 to your computer and use it in GitHub Desktop.
Dynamic template mappings in python DSL
from elasticsearch_dsl import DocType, Object, MetaField
class MyDoc(DocType):
inner = Object()
class Meta:
dynamic_templates = MetaField([
{
'strings_in_inner': {
'path_match': 'inner.*',
'match_mapping_type': 'string',
'mapping': {'type': 'string', 'index': 'not_analyzed'}
}
}
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment