Issue with dynamic index template with a dynamic mapping template


(Wes Plunk) #1

here's the gist https://gist.github.com/1780664

I've setup a index template and within that template a dynamic mapping
template

It seems that when I add a new document with a new field the dynamically
created field uses the dynamic mapping I've setup but some attributes don't
get applied to the new field. The one that stands out from viewing the
resulting config is the "index" attribute doesn't get applied. The other
issue is that when browsing the data I don't see the new field "strField1",
even though the field is config'd to "store" : "yes"

  1. Am I misunderstanding how dynamic templates work
  2. Am I doing what is necessary to allow me to view the new field or is
    there other configuration options that need to be setup
  3. Am I doing what is necessary to allow me to query/index the new field or
    is there other configuration options that need to be setup

I'll be happy to provide more details withint the gist if necessary


(Mohit Chawla) #2

Hello,

On Thu, Feb 9, 2012 at 9:07 PM, Wes Plunk wes@wesandemily.com wrote:

here's the gist

I think you are missing the 'type' you want to apply the dynamic
templates to. If you want to apply it for all types, set it to
default. I wrote a wiki entry for another project to use index
templates & dynamic mappings few days back ( very simplistic ), which
you can probably look at.


(Wes Plunk) #3

If that were the case then what's "match" and "match_mapping_type" for in
my template config. I'm not having the issue that it's not matching, I'm
having the issue that once it's matched the new field with a template it
doesn't seem to setup the new field exactly like the template is defined.
Proof that it actually matched correctly to the predefined template is
there because my custom analyzer is correctly applied to the new field.

"dynamic_templates": [
{
"stringMappingTemplate": {
"match": "",*

  •        "match_mapping_type": "string",*
          "mapping": {
            "type": "string",
            "store": "yes",
            "index": "analyzed",
            "analyzer": "defaultAnalyzerForStringSearching"
          }
        }
      }
    ]

(Wes Plunk) #4

I think I figured it out.

Unless I specify the field the field will not return, so the "store":"yes"
option is definitely working.

My confusion I guess is that the "index":"analyzed" doesn't show up in the
config for the "strField1". It is working correctly but I would have
expected to see that the dynamically generated field would have this
attribute.


(Shay Banon) #5

It won't show index set to analyzed because its the default (to conserve space).

On Friday, February 10, 2012 at 6:29 PM, Wes Plunk wrote:

I think I figured it out.

Unless I specify the field the field will not return, so the "store":"yes" option is definitely working.

My confusion I guess is that the "index":"analyzed" doesn't show up in the config for the "strField1". It is working correctly but I would have expected to see that the dynamically generated field would have this attribute.


(Mohit Chawla) #6

Oops, sorry if I misled Wes. #til

On Sun, Feb 12, 2012 at 7:50 PM, Shay Banon kimchy@gmail.com wrote:

It won't show index set to analyzed because its the default (to conserve
space).

On Friday, February 10, 2012 at 6:29 PM, Wes Plunk wrote:

I think I figured it out.

Unless I specify the field the field will not return, so the "store":"yes"
option is definitely working.

My confusion I guess is that the "index":"analyzed" doesn't show up in the
config for the "strField1". It is working correctly but I would have
expected to see that the dynamically generated field would have this
attribute.


(system) #7