wagoon
wagoon

Reputation: 173

Full dotted path (any level path) with path_match in dynamic_templates

I have this document

{
    "text_foo": "lorem ipsum",
    "one":{
        "two":{
            "three":{
                "text_bar": "dolor sit amet"
            }
        }
    }
}

What i'm trying to acomplish: I need dynamic template, that will match any properties starting with "text_" example:

"mappings" : {
    "dynamic_templates":[
    {
            "text":{
                "match": "text_*",
                "path_match": "*.text_*",
                "match_mapping_type": "*",   
                "mapping":{"type":"text","analyzer":"myCustomAnalyzer"}
            }
        }
    ]
}

Question 1:

Can i use "match" and "path_match" together? (Like in my example)

Question 2:

Will "path_match":"*.text_*" match whole path "one.two.three.text_*" or only `"one.text_*"?

Question 3:

Will "path_match":"*.text_*" match also root property "text_foo"?

Question 4:

If only solution is use regular expresions ("match_pattern":"regex"), will regular expresion match against whole path "one.two.three.text_bar" or only against "text_bar"?

Upvotes: 6

Views: 755

Answers (0)

Related Questions