Benefit of using Static Template


(Varun Somani) #1

Are there any benefit of using static template over dynamic template? I was hoping to do some space optimizations.

My input data are mostly constant but can change with addition of some fields

To give more context,
Most of my fields are number who I want to aggregate on. The string fields are very less ~10%. If I use a static template and mark those field not_analyzed would I be gaining a huge advantage ?

Can I still aggregate over number if they are not analyzed ?

With addition of new fields that are not present in template would the field still get populated ?

I am planning to use ES 6.2.


(Mark Walkom) #2

Static are more efficient.

In space use, it'll help.

They shouldn't be analysed.

If you setup strict mapping they will be rejected/ignored.

Then you need to think in terms of keywords (not_analyzed) and text (analyzed), that was changed in 6.X.


(Varun Somani) #3

Thanks Mark for the info. Just a quick follow-up.

"duration": {
            "type": "long",
            "index": "not_analyzed"
}

is the above statement valid and useful ? Also, just to confirm I would still be able to do aggregation like percentile/avg on duration without it being analyzed?

Also according to this,
https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic.html
I can have nested arguments which are dynamic. I think that is what I am looking for and should work in my use case.


(Mark Walkom) #4

Numbers are inherently not analysed.


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.