Hey,

which ES version are you using? Seems to work with the latest version. You
can also use the index template API, so you do not have to fiddle with
local files (and copy them when adding new nodes).

PUT _template/automap
{
  "template": "*",
  "mappings": {
    "_default_": {
      "numeric_detection": true,
      "properties": {
        "message": {
          "type": "string"
        },
        "host": {
          "type": "string"
        },
        "@version": {
          "type": "string"
        }
      }
    }
  }
}



--Alex


On Tue, Jun 3, 2014 at 5:57 PM, Brian <[email protected]> wrote:

> I am not sure if this is a problem or if it's OK.
>
> Working with the ELK stack I have switched direction, and instead of
> locking down the Elasticsearch mappings I am now using its automatic
> mapping functions. And by adding the following JSON template definition to
> the /*path.to.config*/templates/automap.json file I can get numeric
> fields automatically correctly mapped even though logstash always emits
> their values as strings ("45.6" instead of 45.6). Very nice!
>
> {
>   "automap" : {
>     "template" : "*",
>     *"settings" : { },*
>     "mappings" : {
>       "_default_" : {
>         "numeric_detection" : true,
>         "properties" : {
>           "message" : {"type" : "string"},
>           "host" : {"type" : "string"},
>           "@version" : {"type" : "string"}
>         }
>       }
>     }
>   }
> }
>
> When I removed the *"settings":{}* entirely, it was as if the template
> did not exist; the numeric detection was not enabled and all string values
> were seen as strings even if they contained numbers. Because all of the
> settings are being controlled within elasticsearch.yml and not the template
> (e.g. number of shards, number of replicas, and so on), eliminating the
> settings from the template is desired, even if I have to leave it in but
> set its value to the empty JSON object.
>
> If this is the way it's supposed to work, that's OK. But I couldn't find
> anything in the documentation about it, and just wanted to get a
> verification either way.
>
> Thanks!
>
> Brian
>
> --
> You received this message because you are subscribed to the Google Groups
> "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/ff4afb8e-c3e4-4772-aa48-bd6a651c78e8%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/ff4afb8e-c3e4-4772-aa48-bd6a651c78e8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9g43jE8cKehZLNxBNbFZs2jrpw%3DRnbC5b%3DO10uJSr5Pg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to