Skip to content

Instantly share code, notes, and snippets.

@fabiante
Created November 21, 2018 12:35
Show Gist options
  • Save fabiante/d59e877a15a7e6fb054c9c524742d6da to your computer and use it in GitHub Desktop.
Save fabiante/d59e877a15a7e6fb054c9c524742d6da to your computer and use it in GitHub Desktop.
Elasticsearch - Dynamic Template for Java util.Map fields
PUT /archive_document
{
"mappings": {
"document": {
"dynamic_templates": [
{
"map_string": {
"match_mapping_type": "string",
"path_match": "fields.*",
"mapping": {
"type": "text"
}
}
}
]
}
}
}
@fabiante
Copy link
Author

This template is just a starter and needs lots of adjustments for your needs. For now the template matches only strings.
The idea is to create a template that maps Java's util.Map instances as plain JSON objects. Every map entry should be indexed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment