Template has non analyzed field, but _mapping doesn't show it

I'm trying to verify if a template is getting applied to my index. I have my template to set certain fields to be non-analyzed, but the _mapping api doesn't show if it is or not.
Here is my template when I do a GET _tempate/sales*

    {
        "sales_template": {
            "order": 0,
            "template": "sales_*",
            "settings": {
                "index": {
                    "number_of_shards": "5",
                    "number_of_replicas": "1"
                }
            },
            "mappings": {
                "sales": {
                    "_all": {
                        "enabled": false
                    },
                    "properties": {
                        "total_sale_amount": {
                            "type": "double"
                        },              
                        "location": {
                            "index": "not_analyzed",
                            "type": "text"
                        }
                    }
                }
            },
            "aliases": {}
        }
    }

GET sales_20/_mapping

{
    "sales_20": {
        "mappings": {
            "weekly_sales": {
                "_all": {
                    "enabled": false
                },
                "properties": {
                    "location": {
                        "type": "text"
                    },
                    "total_sale_amount": {
                        "type": "double"
                    }
									}
            }
        }
    }
}

I feel that when I get the mapping for the index it should say the location is non_analyzed.

@JonathanAaron you need to show us what you've done, otherwise we can't help

Thanks Clinton, I just updated my question with some of the results I was getting.

Hi @JonathanAaron

analyzed/not_analyzed is only relevant to the old string fields. text fields are all analyzed. keyword fields are not analyzed.

i'm surprised that you didn't get an exception when that field was created, but it is probably some of the bwc layer between string/text/keyword that ended up just ignoring the not_analyzed.

summary: use keyword instead of text for that field

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