Dynamic mapping problems ES 1.3.4


(Madhav Kelkar) #1

Hi All,
I recently came across a scenario with dynamic mappings. I have an index created with the following mapping:

PUT /test/_mapping/entity 
{
    "properties" : {
        "message" : {
            "type" : "string", 
            "store" : false, 
            "index": "not_analyzed"
        },
        "user": {
            "type":"object"
        }
    },
    "dynamic_templates" : [
    {
        "message-lowercase": {
            "path_match": "(\\Quser.message.lc\\E$)",
            "match_pattern": "regex",
            "mapping": {
                "type" : "string", 
                "store" : true, 
                "index": "not_analyzed"
            }
        }
    },
    {
        "message-dynamic": {
            "path_match": "\\Qmessage\\E$",
            "match_pattern": "regex",
            "mapping": {
                "type" : "string", 
                "store" : false, 
                "index": "not_analyzed"
            }
        }
    }
    ]
}

Then, I create a document -

PUT /test/entity/demo1 
{
    "message": "X",
    "user": {
        "message": "Y",
        "message.lc": "y"
    }
}

now if I search like this -

GET _search 
{
    "filter": {
        "term": {
           "message.lc": "y"
        } 
    }
}

I get 1 hit, which is demo1, which I think should not happen. I am not sure whats wrong with the template...any clues on what I am I missing? I am using ES 1.3.4.

Thanks,
Madhav.


(system) #2