Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature suggestion - dynamic template allowing _parent definition #3312

Closed
rore opened this issue Jul 10, 2013 · 3 comments
Closed

Feature suggestion - dynamic template allowing _parent definition #3312

rore opened this issue Jul 10, 2013 · 3 comments

Comments

@rore
Copy link

rore commented Jul 10, 2013

The use case is this -

I have (rather big) documents that can have many sub-attributes which are updated frequently. These attributes are kept as child documents, with the big document as the parent.
The parent document can have arbitrary type, and those types are dynamic and can be created on the fly.

The child type has a common structure - _attr (so for example for parent "book" the child type will be "book_attr").

I want to be able to have a template that automatically defines the right parent mapping on the child type.
So I need to be able to set a template that uses regex and not wildcard on the name and allows using captures from it in the mapping definition. so it will be something like -

{
"template" : "(.*)_attr",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"attributes" : {
"_parent" : {
"type" : "{0}"
}
}
}
}

@Asimov4
Copy link
Contributor

Asimov4 commented Jun 26, 2014

Do you imply:

  1. that dynamic mappings for the _parent field don't work
    or
  2. that you would like a new way to set dynamic mappings with regexps
    ?

@rore
Copy link
Author

rore commented Jun 27, 2014

#2. I"d like to be able to define the index names the template works for as a regex and not a wildcard, and to be able to use capture groups from the regex inside the template definition. So, in my example, you can assign a template to catch specific format of index names, and automatically create a child type where the parent is derived from the captured index name.

@clintongormley
Copy link

i'm -1 on this. It just introduces a level of complexity that i'm uncomfortable with, plus it is not bwc. Currently we allow simple patterns (ie shell globbing). We can't support those and regexes in the same place without having some flag... ie more complexity.

Elasticsearch should support common use cases simply, and allow more complex stuff to be done via the app. I don't think the API should be bent to support corner cases, as it makes it more complex (and likely buggier) for everybody.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants