# Geographical queries

**URL:** <https://discuss.elastic.co/t/geographical-queries/120116>\
**Category:** Elasticsearch\
**Created:** [February 16, 2018, 8:01am UTC](https://discuss.elastic.co/t/geographical-queries/120116 "2018-02-16T08:01:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ftaran](https://avatars.discourse-cdn.com/v4/letter/f/c77e96/32.png) [@ftaran](https://discuss.elastic.co/u/ftaran)\
**Post date:** [February 16, 2018, 8:01am UTC](https://discuss.elastic.co/t/geographical-queries/120116/1 "2018-02-16T08:01:20Z")

</div>

I have several questions regarding geographical queries,

1. is it possible when doing a shape or polygon query to use the shape or polygon queries of another document, and not have to pass this information through the network, so basically you could refer to a field in another document in your query.

2. is it possible to make a search on multiple fields in a document that represent coordinates, for example

3.is it possible to ask for all the points that fall within a shape or polygon or distance from a point but also specify not to return any point that do or do not fall within another polygon, so basically a Inner join or Left or right join.

4.is it possible to combine shape or polygon queries with GeoHashing, for example do a query that says give me all the document that fall within this GeoHash but do or do not fall in this polygon, again a inner join or left or right join scenario.

finally what are the performance implications?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 16, 2018, 8:15am UTC](https://discuss.elastic.co/t/geographical-queries/120116/2 "2018-02-16T08:15:58Z")

</div>

I think you might want to look at [https://www.elastic.co/guide/en/elasticsearch/reference/6.2/query-dsl-geo-shape-query.html#\_pre\_indexed\_shape](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/query-dsl-geo-shape-query.html#_pre_indexed_shape)

---

<div class="post-metadata">

**Author:** ![ftaran](https://avatars.discourse-cdn.com/v4/letter/f/c77e96/32.png) [@ftaran](https://discuss.elastic.co/u/ftaran)\
**Post date:** [February 16, 2018, 8:18am UTC](https://discuss.elastic.co/t/geographical-queries/120116/3 "2018-02-16T08:18:57Z")

</div>

Thanks for your reply, do you have any info on item 3 or 4?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 16, 2018, 8:37am UTC](https://discuss.elastic.co/t/geographical-queries/120116/4 "2018-02-16T08:37:25Z")

</div>

1. Yes. I guess with a bool query with a `filter` clause (for what must match) and a `must_not` clause for what must not..

2. I guess so with the same solution I gave in 3. Not an expert on that though...

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 16, 2018, 8:37am UTC](https://discuss.elastic.co/t/geographical-queries/120116/5 "2018-03-16T08:37:56Z")

</div>

Closed on March 16, 2018, 8:37am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
