I've finally gotten geo_distance queries to function. Apparently,
http://www.elasticsearch.org/guide/reference/api/admin-indices-templates.htmlsays that the config/templates subdirectory can be used to hold templates
but that doesn't work on ES 19.10. So curl -XPUT works.
But I do have two questions:
- Should re-indexing existing data pick up the mappings in a newly added
template, or is that done only when the index is initially created?
I completely erased my current test data, and then reloaded it without
storing the geo_point mappings template. As expected, my geo_distance
queries failed with exceptions.
So then I -XPUT the template and the mappings are seen. And as expected,
the geo_distance queries against the current data still fail.
But when I re-indexed all of the data (scan + index each and every
document), the geo_distance queries still failed the same way.
It was only when I deleted the index and then reloaded the data that the
geo_distance queries worked.
- Does changing the indexing configuration automatically reindex existing
data?
Earlier, I was working to get the default analyzer to disable stopwords and
add the snowball stemming. Really cool. Especially with one of Shay's posts
that showed how to put this into my elasticsearch.yml file and have it
enabled for all indices.
So then I tried some migration test cases. I first stopped ES and rm -rf
the data directory. I then restarted ES, bulk-loaded my data, and confirmed
that indeed I could not find org=and because the built-in default analyzer
defines AND as a stopword.
Then I stopped ES and updated the elasticsearch.yml configuration with the
overrides. But when I restarted ES and queried the existing data, I could
now find org=and successfully. I didn't need to reindex. I even found
org=sunny to match "Sunny's Sunglasses" (one of my stemming test cases).
It's as if ES detected the updated _default analyzer configuration and
re-indexed my data for me as it started up. Is this a correct assumption?
--