# Is there a difference between indexing envelopes or polygons

**URL:** <https://discuss.elastic.co/t/is-there-a-difference-between-indexing-envelopes-or-polygons/15965>\
**Category:** Elasticsearch\
**Created:** [February 22, 2014, 10:14am UTC](https://discuss.elastic.co/t/is-there-a-difference-between-indexing-envelopes-or-polygons/15965 "2014-02-22T10:14:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_THOMASSON](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicolas_thomasson/32/1772_2.png) [@Nicolas\_THOMASSON](https://discuss.elastic.co/u/Nicolas_THOMASSON)\
**Post date:** [February 22, 2014, 10:14am UTC](https://discuss.elastic.co/t/is-there-a-difference-between-indexing-envelopes-or-polygons/15965/1 "2014-02-22T10:14:32Z")

</div>

Hello,

I'm new to ES. Please forgive me if I'm asking something stupid.

Is there a fundamental difference between indexing an envelope or indexing  
a polygon ?

For example if I define the area as a envelope

{  
"frame":{  
"type":"envelope",  
"coordinates": [[3,4],[1,2]]  
}  
}

or as a polygon

{  
"frame":{  
"type":"polygon",  
"coordinates": [[[3,4],[3,2],[1,2],[1,4],[3,4]]]  
}  
}

As in my comprehension they both define the same area, should I be able to  
perform the same queries whatever the way I defined the area ? (Currently I  
have a search query that returns wrong results on the envelope and seems to  
perform well on the polygon.)

Thanks for your help,

Nicolas

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a2fa0fd8-f9a9-435b-9d34-e603c7242d2f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a2fa0fd8-f9a9-435b-9d34-e603c7242d2f%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 24, 2014, 2:58pm UTC](https://discuss.elastic.co/t/is-there-a-difference-between-indexing-envelopes-or-polygons/15965/2 "2014-02-24T14:58:24Z")

</div>

Hey,

if there is an error, can you please open a github issue? However the  
envelope shape expects you to set an upper left and lower right boundary.  
Your coordinates more look like lower left and upper right (meaning you  
might create quite a huge envelope acutally) - which obviously does not  
matter for a polygon

--Alex

On Sat, Feb 22, 2014 at 11:14 AM, Nicolas THOMASSON \<  
[nico.thomasson@gmail.com](mailto:nico.thomasson@gmail.com)\> wrote:

> Hello,
> 
> I'm new to ES. Please forgive me if I'm asking something stupid.
> 
> Is there a fundamental difference between indexing an envelope or indexing  
> a polygon ?
> 
> For example if I define the area as a envelope
> 
> {  
> "frame":{  
> "type":"envelope",  
> "coordinates": [[3,4],[1,2]]  
> }  
> }
> 
> or as a polygon
> 
> {  
> "frame":{  
> "type":"polygon",  
> "coordinates": [[[3,4],[3,2],[1,2],[1,4],[3,4]]]  
> }  
> }
> 
> As in my comprehension they both define the same area, should I be able to  
> perform the same queries whatever the way I defined the area ? (Currently I  
> have a search query that returns wrong results on the envelope and seems to  
> perform well on the polygon.)
> 
> Thanks for your help,
> 
> Nicolas
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/a2fa0fd8-f9a9-435b-9d34-e603c7242d2f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a2fa0fd8-f9a9-435b-9d34-e603c7242d2f%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM8usW%3Deam07T1xjFsTDOP1Yuay-DvVrkec2JzeQu0e3ng%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM8usW%3Deam07T1xjFsTDOP1Yuay-DvVrkec2JzeQu0e3ng%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Nicolas\_THOMASSON](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicolas_thomasson/32/1772_2.png) [@Nicolas\_THOMASSON](https://discuss.elastic.co/u/Nicolas_THOMASSON)\
**Post date:** [February 25, 2014, 9:38am UTC](https://discuss.elastic.co/t/is-there-a-difference-between-indexing-envelopes-or-polygons/15965/3 "2014-02-25T09:38:51Z")

</div>

Hey thanks a lot !

Now it works just fine. I didn't see that coming, I thought ES was  
complaining if envelope's coordinates was reverted. My bad...

Nicolas

Le lundi 24 février 2014 15:58:24 UTC+1, Alexander Reelsen a écrit :

> Hey,
> 
> if there is an error, can you please open a github issue? However the  
> envelope shape expects you to set an upper left and lower right boundary.  
> Your coordinates more look like lower left and upper right (meaning you  
> might create quite a huge envelope acutally) - which obviously does not  
> matter for a polygon
> 
> --Alex
> 
> On Sat, Feb 22, 2014 at 11:14 AM, Nicolas THOMASSON \<[nico.th...@gmail.com](mailto:nico.th...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Hello,
> > 
> > I'm new to ES. Please forgive me if I'm asking something stupid.
> > 
> > Is there a fundamental difference between indexing an envelope or  
> > indexing a polygon ?
> > 
> > For example if I define the area as a envelope
> > 
> > {  
> > "frame":{  
> > "type":"envelope",  
> > "coordinates": [[3,4],[1,2]]  
> > }  
> > }
> > 
> > or as a polygon
> > 
> > {  
> > "frame":{  
> > "type":"polygon",  
> > "coordinates": [[[3,4],[3,2],[1,2],[1,4],[3,4]]]  
> > }  
> > }
> > 
> > As in my comprehension they both define the same area, should I be able  
> > to perform the same queries whatever the way I defined the area ?  
> > (Currently I have a search query that returns wrong results on the envelope  
> > and seems to perform well on the polygon.)
> > 
> > Thanks for your help,
> > 
> > Nicolas
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/a2fa0fd8-f9a9-435b-9d34-e603c7242d2f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a2fa0fd8-f9a9-435b-9d34-e603c7242d2f%40googlegroups.com)  
> > .  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/01f3c770-60b3-494c-bac5-bba5a1ef673e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/01f3c770-60b3-494c-bac5-bba5a1ef673e%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 25, 2014, 12:13pm UTC](https://discuss.elastic.co/t/is-there-a-difference-between-indexing-envelopes-or-polygons/15965/4 "2014-02-25T12:13:16Z")

</div>

Hey,

the problem here is that elasticsearch cant tell by itself if the envelope  
borders need to be reverted or not... maybe you want/need such an envelope  
in your calculations. Hard to tell from a machine perspective 🙂

--Alex

On Tue, Feb 25, 2014 at 10:38 AM, Nicolas THOMASSON \<  
[nico.thomasson@gmail.com](mailto:nico.thomasson@gmail.com)\> wrote:

> Hey thanks a lot !
> 
> Now it works just fine. I didn't see that coming, I thought ES was  
> complaining if envelope's coordinates was reverted. My bad...
> 
> Nicolas
> 
> Le lundi 24 février 2014 15:58:24 UTC+1, Alexander Reelsen a écrit :
> 
> > Hey,
> > 
> > if there is an error, can you please open a github issue? However the  
> > envelope shape expects you to set an upper left and lower right boundary.  
> > Your coordinates more look like lower left and upper right (meaning you  
> > might create quite a huge envelope acutally) - which obviously does not  
> > matter for a polygon
> > 
> > --Alex
> > 
> > On Sat, Feb 22, 2014 at 11:14 AM, Nicolas THOMASSON \<[nico.th...@gmail.com](mailto:nico.th...@gmail.com)
> > 
> > > wrote:
> > 
> > > Hello,
> > > 
> > > I'm new to ES. Please forgive me if I'm asking something stupid.
> > > 
> > > Is there a fundamental difference between indexing an envelope or  
> > > indexing a polygon ?
> > > 
> > > For example if I define the area as a envelope
> > > 
> > > {  
> > > "frame":{  
> > > "type":"envelope",  
> > > "coordinates": [[3,4],[1,2]]  
> > > }  
> > > }
> > > 
> > > or as a polygon
> > > 
> > > {  
> > > "frame":{  
> > > "type":"polygon",  
> > > "coordinates": [[[3,4],[3,2],[1,2],[1,4],[3,4]]]  
> > > }  
> > > }
> > > 
> > > As in my comprehension they both define the same area, should I be able  
> > > to perform the same queries whatever the way I defined the area ?  
> > > (Currently I have a search query that returns wrong results on the envelope  
> > > and seems to perform well on the polygon.)
> > > 
> > > Thanks for your help,
> > > 
> > > Nicolas
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > 
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/a2fa0fd8-f9a9-435b-9d34-e603c7242d2f%  
> > > [40googlegroups.com](http://40googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/01f3c770-60b3-494c-bac5-bba5a1ef673e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/01f3c770-60b3-494c-bac5-bba5a1ef673e%40googlegroups.com)  
> > .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM8\_oP8dVY4%3DBur2eWxbiJDXUx9LxpjXnBqpRksk1yQnkQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM8_oP8dVY4%3DBur2eWxbiJDXUx9LxpjXnBqpRksk1yQnkQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 1:47am UTC](https://discuss.elastic.co/t/is-there-a-difference-between-indexing-envelopes-or-polygons/15965/5 "2017-07-06T01:47:29Z")

</div>


