We are using ES 17.14 and have looked at the docs but have been unable to create a query and wondered if anyone can shed some light on it.
1- We have an IndexA that has a FieldA of type Geoshape with its latitude and longitude
2- We have another IndexB that has a FieldB of type Number(integer) that represents the radius of an imaginary circle in meters.
What we would like to do is that for a given record in IndexA to find all records in IndexB that the FieldA in IndexA falls within that imaginary circle represented by the FieldB radius value.
Thanks
IndexB also has a geo_shape field, right? Could you provide a few documents from each index and a sample query with expected result? Just to clarify what you want to achieve.
ES queries can't perform joins, but if you provide the coordinates from your document in indexA you can dynamically compute the distance between that point and each document from indexB and filter those where the radius field is bigger than the distance. You can do this with a script query.
The script would be something like this assuming indexB has a my_geom_field of geo_point type, and a radius field.
Hi
Thanks for your response.
We decided that using this technique is too much computation per query. So we decided to actually create a geometry in IndexB and use the patern:
filter.Add(fq => fq.GeoShape(g => g.Field("FieldA in Index A").Relation(GeoShapeRelation.Within).IndexedShape(f => f.Id(Id of record in Index A).Index("IndexB").Path("geometry in IndexB"))));
This pattern uses both indicies whithout requiring any joins.
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.