Issue with application of dynamic templates

Hey

Just saw this. Maybe I am doing something wrong, or could be a
possible bug with dynamic templates. Code to reproduce is at
git@github.com:diptamay/es-issue.git. ES version is latest trunk.

Scenario:

When dynamic templates are defined in seed mappings, they get
correctly applied ONLY when ONE template is define and not when
multiple templates are present.

Steps to setup and reproduce:

  1. Ensure ES is running at localhost:9200 (look at configuration
    below)
  2. run ./automate.sh.
    a) This will create an es-test index with the seed mappings and
    load the sample data.
    b) Then it fires a query which returns results correctly.
  3. Now look at the metadata generated by ES.
    a) You will see that the dynamic templates got applied for the
    "video" type.
    b) You will see the templates did not kick in for the "lineup"
    type. Note: multiple templates have been provided for lineup in the
    seed.

Configuration of ES:

cluster:
name: sanyal
gateway:
type: fs
fs:
location: /Users/sanyal/Documents/workspace/hb_indices
index:
memory:
enabled: true
gateway:
snapshot_interval : 30s
store:
type: niofs
number_of_shards : 2
number_of_replicas : 1
path:
home: /Users/sanyal/Installs/elasticsearch
logs: /Users/sanyal/Documents/workspace/logs

Hi,

The definition for more than one template you have in the lineup mapping
is incorrect, here is the correct one (its an array of json objects):

    "dynamic_templates" : [
        {
            "template_1" : {
                "path_match" : "fields.umpire_id_*",
                "mapping" : {
                    "type" : "string",
                    "index" : "not_analyzed"
                }
            }
        },
        {
            "template_2" : {
                "path_match" : "tags.*.value",
                "mapping" : {
                    "type" : "string",
                    "index" : "not_analyzed"
                }
            }
        }
    ]

-shay.banon

On Mon, Nov 15, 2010 at 9:21 PM, diptamay diptamay@gmail.com wrote:

Hey

Just saw this. Maybe I am doing something wrong, or could be a
possible bug with dynamic templates. Code to reproduce is at
git@github.com:diptamay/es-issue.git. ES version is latest trunk.

Scenario:

When dynamic templates are defined in seed mappings, they get
correctly applied ONLY when ONE template is define and not when
multiple templates are present.

Steps to setup and reproduce:

  1. Ensure ES is running at localhost:9200 (look at configuration
    below)
  2. run ./automate.sh.
    a) This will create an es-test index with the seed mappings and
    load the sample data.
    b) Then it fires a query which returns results correctly.
  3. Now look at the metadata generated by ES.
    a) You will see that the dynamic templates got applied for the
    "video" type.
    b) You will see the templates did not kick in for the "lineup"
    type. Note: multiple templates have been provided for lineup in the
    seed.

Configuration of ES:

cluster:
name: sanyal
gateway:
type: fs
fs:
location: /Users/sanyal/Documents/workspace/hb_indices
index:
memory:
enabled: true
gateway:
snapshot_interval : 30s
store:
type: niofs
number_of_shards : 2
number_of_replicas : 1
path:
home: /Users/sanyal/Installs/elasticsearch
logs: /Users/sanyal/Documents/workspace/logs

My apologies for missing that.

Thanks
Diptamay

On Nov 16, 3:55 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Hi,

The definition for more than one template you have in the lineup mapping
is incorrect, here is the correct one (its an array of json objects):

    "dynamic_templates" : [
        {
            "template_1" : {
                "path_match" : "fields.umpire_id_*",
                "mapping" : {
                    "type" : "string",
                    "index" : "not_analyzed"
                }
            }
        },
        {
            "template_2" : {
                "path_match" : "tags.*.value",
                "mapping" : {
                    "type" : "string",
                    "index" : "not_analyzed"
                }
            }
        }
    ]

-shay.banon

On Mon, Nov 15, 2010 at 9:21 PM, diptamay dipta...@gmail.com wrote:

Hey

Just saw this. Maybe I am doing something wrong, or could be a
possible bug with dynamic templates. Code to reproduce is at
g...@github.com:diptamay/es-issue.git. ES version is latest trunk.

Scenario:

When dynamic templates are defined in seed mappings, they get
correctly applied ONLY when ONE template is define and not when
multiple templates are present.

Steps to setup and reproduce:

  1. Ensure ES is running at localhost:9200 (look at configuration
    below)
  2. run ./automate.sh.
    a) This will create an es-test index with the seed mappings and
    load the sample data.
    b) Then it fires a query which returns results correctly.
  3. Now look at the metadata generated by ES.
    a) You will see that the dynamic templates got applied for the
    "video" type.
    b) You will see the templates did not kick in for the "lineup"
    type. Note: multiple templates have been provided for lineup in the
    seed.

Configuration of ES:

cluster:
name: sanyal
gateway:
type: fs
fs:
location: /Users/sanyal/Documents/workspace/hb_indices
index:
memory:
enabled: true
gateway:
snapshot_interval : 30s
store:
type: niofs
number_of_shards : 2
number_of_replicas : 1
path:
home: /Users/sanyal/Installs/elasticsearch
logs: /Users/sanyal/Documents/workspace/logs