-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
8.0 Feature request Add Fluent helper for DynamicTemplates #8465
Comments
Hi @niemyjski , I guess this is about this construct: public ICollection<IDictionary<string, DynamicTemplate>>? DynamicTemplates { get; set; } SpecificationI recently made some changes to the related specification (elastic/elasticsearch-specification#3824). This alone does not help here, but I have a strong feeling that the actual type should be public ICollection<KeyValuePair<string, DynamicTemplate>>? DynamicTemplates { get; set; } ... which in theory is the same as a regular Will doMy plan is to expose this property as just For descriptors, this would also be fully transparent to the user as you won't have to care about manually creating a dictionary. The problem is with the regular object initializer syntax where the If my above assumtion is correct and we can get away with just .DynamicTemplates(templates => templates
.Add("my_template", template => template.XXX()...)
.Add("my_second_template", template => template.XXX().YYY()...) Won't doOther than that, the dictionary type will stay. It's basically the same change that has been made for For the object representation, this means that the For the usages this means that we have to deal with |
That sounds good, just curious why ordering matters? |
@niemyjski I was surprised as well, but turns out Elasticsearch will always use the first matching template. That allows to add templates for very specific conditions first while still having more generic fallbacks later in the list. And we already confirmed that my assumption was indeed correct and I can move forward with implementing this usability improvement 🙂 |
Is your feature request related to a problem? Please describe.
The new list syntax leaves a lot ot be desired and a bit of a pain to upgrade to.
Describe the solution you'd like
.DynamicTemplates(t => t.DynamicTemplate("idx_text", t1 => t1.Match("text*").Mapping(m1 => m1.Text(mp => mp.AddKeywordAndSortFields()))))
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: