Q about enabling _size with mapper-size plugin

I've installed the mapper-size plugin on my Elasticsearch 2.2.1 cluster, restarted all the nodes, and have attempted to follow the instructions to enable it on an existing index (which might be the problem).

Here's what the docs say to use to enable the _size field:

PUT my_index
{
"mappings": {
"my_type": {
"_size": {
"enabled": true
}
}
}
}

Here's the query I'm issuing, modeled on the one above:

PUT logstash-2016.03.31
{
"mappings": {
"log": {
"_size": {
"enabled": true
}
}
}
}

Which give me:

{
"error": {
"root_cause": [
{
"type": "index_already_exists_exception",
"reason": "already exists",
"index": "logstash-2016.03.31"
}
],
"type": "index_already_exists_exception",
"reason": "already exists",
"index": "logstash-2016.03.31"
},
"status": 400
}

So, either I'm wrong or the docs are. Would appreciate someone in the know telling me which, and how to fix it, if possible.

A related question: now that I've installed the size mapper, assuming I can't retroactively apply this field to my existing indexes, will new auto-generated indexes automatically get the _size field, or do I have to do something else to enable it for all indexes? Still feel like a noob to Elasticsearch, probably always will. Appreciate the help.

The docs are about starting from scratch with a new index. They use the create index api and provide the mappings while creating the index. You should instead use the put mapping api to provide the mapping, as your index already exists. I am not too sure though it's a good idea to do that on an existing index (not even sure it's allowed), cause then some docs will have the field while some others won't. Better to start from a new index, then you can follow the docs and they look ok.

As for your last question, the _size field gets enabled per type, and you have multiple types per index. If you want to enable for all your future indices you can use index templates, and also apply it to all types using the default type keyword instead of a concrete type.

Cheers
Luca

Thanks!