May be I am missing something then. So all I did is, I ran the above curl command to create the template, then I created my river with my index index as follows:
And when I search for my index 'role_index', I see all fields instead of just _id and prkey fields. Which means template is not getting applied to index that I create afterwards.
Here is how I do the search:
GET role_index/_search?pretty=true
Ok, that's expected.
With your template you aren't telling ES to only process these fields, you are saying you are only defining what these fields should be. It'll still index the rest of them and just dynamically figure out what they should be (string, int etc). Check your logs and you should see mention of dynamic mapping updates for that index.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.