HI,
I have an index with documents that contain a geo_point field.
I want to have a query where the user gives a zipcode, I translate it to long/lat based on some static mapping and return relevant results with the geo_distance query. I don't want the client side to do the translation and submit long/lats.
Can it be done? I looked at ingest node scripting to alter the query, but couldn't find a processor that can do a key-value lookup on another index (that will hold all mappings) or read mapping from a file on disk.
Can a painless (or other language) script query an ES index?
Ingest node is for preparing documents to index, not queries to run.
You'd need to get hold of the data that has coordinates for each zipcode and you could put that into elasticsearch and then run a preliminary query to get the coordinates for a given postcode. Instead you could use some custom server-side logic to cache all the zipcodes in memory and look coordinates up using that.
It is a special case of my reference plugin https://github.com/jprante/elasticsearch-analysis-reference where a new field type could be introduced to translate a zip code to a geo field. The translation could be implemented by a lookup of geo coordinates stored in a zip code 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.