Incorrect results from geo_shape filter

Hey Everyone,

I have a nested document that includes a spatial component that I'm using
in a spatial query via the geo_shape filter.
I've noticed that the filter consistently returns a result that includes a
geometry that clearly falls outside the spatial filter.
I've tested the spatial intersection in PostGIS and that correctly returns
back no result from the same query.

Can anyone else verify this? We have lots of other MultiPolygon data that
seems to work just fine.

I'm using the REST api against ES v1.4.1

Here's the document I'm testing against:

{"dates": [],
"geometries": [{
"value": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-118.32608,
34.07035],
[-118.32657,
34.07035],
[-118.32657,
34.07054],
[-118.32608,
34.07054],
[-118.32608,
34.07035]
]
],
[
[
[-118.32608,
34.07021],
[-118.32608,
34.07004],
[-118.32657,
34.07004],
[-118.32657,
34.07021],
[-118.32608,
34.07021]
]
]
]
},
"label": "MULTIPOLYGON (((-118.32608 34.07035,-118.32657
34.07035,-118.32657 34.07054,-118.32608 34.07054,-118.32608
34.07035)),((-118.32608 34.07021,-118.32608 34.07004,-118.32657
34.07004,-118.32657 34.07021,-118.32608 34.07021)))",
"child_entities": [],
"entitytypeid": "SPATIAL_COORDINATES_GEOMETRY.E47",
"parentid": "80446382-0e96-4db1-8a37-95aca166b785",
"entityid": "81b06621-2989-4825-98f3-88ee2ac937b6",
"property": "P87",
"businesstablename": "geometries"
}],
"child_entities": [{
"value": "Windsor Square District Non-Contributor",
"label": "Windsor Square District Non-Contributor",
"child_entities": [],
"entitytypeid": "NAME.E41",
"parentid": "5fbe787f-8fc3-4986-b77a-38828699b68c",
"entityid": "62a82362-b7c3-4ad2-ba58-29bab7dc5dbb",
"property": "P1",
"businesstablename": "strings"
}, {
"value": "",
"label": "",
"child_entities": [],
"entitytypeid": "PLACE.E53",
"parentid": "5fbe787f-8fc3-4986-b77a-38828699b68c",
"entityid": "80446382-0e96-4db1-8a37-95aca166b785",
"property": "P53",
"businesstablename": ""
}],
"label": "",
"date_groups": [],
"primaryname": "Windsor Square District Non-Contributor",
"value": "",
"entitytypeid": "HERITAGE_RESOURCE.E18",
"domains": [{
"conceptid": "a5675b84-fed4-4839-9afa-434be64c3899",
"child_entities": [],
"label": "Primary",
"value": "b171b37b-4c78-4b51-91a9-503541511be4",
"entitytypeid": "NAME_TYPE.E55",
"parentid": "62a82362-b7c3-4ad2-ba58-29bab7dc5dbb",
"entityid": "4bd86b01-a047-4e7a-953a-00d2243e39db",
"property": "P2",
"businesstablename": "domains"
}],
"entityid": "5fbe787f-8fc3-4986-b77a-38828699b68c",
"property": "",
"businesstablename": ""}

Here's the DSL:

{
"query": {
"filtered": {
"filter": {
"and": [
{
"bool": {
"should": [],
"must_not": [],
"must": [
{
"nested": {
"path": "geometries",
"query": {
"geo_shape": {
"geometries.value": {
"shape": {
"type": "Point",
"coordinates": [
-118.34194465228431,
34.06402964781424
]
}
}
}
}
}
}
]
}
}
]
},
"query": {
"match_all": {}
}
}
},
"from": 0,
"size": 5
}

Here's the mapping for the index:

"properties": {
"businesstablename": {
"index": "not_analyzed",
"type": "string"
},
"child_entities": {
"type": "nested",
"properties": {
"businesstablename": {
"index": "not_analyzed",
"type": "string"
},
"entitytypeid": {
"index": "not_analyzed",
"type": "string"
},
"property": {
"index": "not_analyzed",
"type": "string"
},
"entityid": {
"index": "not_analyzed",
"type": "string"
},
"label": {
"index": "not_analyzed",
"type": "string"
},
"value": {
"type": "string",
"fields": {
"raw": {
"index": "not_analyzed",
"type": "string"
},
"folded": {
"analyzer": "folding",
"type": "string"
}
}
},
"parentid": {
"index": "not_analyzed",
"type": "string"
}
}
},
"entitytypeid": {
"index": "not_analyzed",
"type": "string"
},
"domains": {
"type": "nested",
"properties": {
"businesstablename": {
"index": "not_analyzed",
"type": "string"
},
"entitytypeid": {
"index": "not_analyzed",
"type": "string"
},
"property": {
"index": "not_analyzed",
"type": "string"
},
"conceptid": {
"index": "not_analyzed",
"type": "string"
},
"entityid": {
"index": "not_analyzed",
"type": "string"
},
"label": {
"index": "not_analyzed",
"type": "string"
},
"value": {
"type": "string",
"fields": {
"raw": {
"index": "not_analyzed",
"type": "string"
}
}
},
"parentid": {
"index": "not_analyzed",
"type": "string"
}
}
},
"dates": {
"type": "nested",
"properties": {
"businesstablename": {
"index": "not_analyzed",
"type": "string"
},
"entitytypeid": {
"index": "not_analyzed",
"type": "string"
},
"property": {
"index": "not_analyzed",
"type": "string"
},
"entityid": {
"index": "not_analyzed",
"type": "string"
},
"label": {
"index": "not_analyzed",
"type": "string"
},
"value": {
"format": "dateOptionalTime",
"type": "date"
},
"parentid": {
"index": "not_analyzed",
"type": "string"
}
}
},
"entityid": {
"index": "not_analyzed",
"type": "string"
},
"label": {
"index": "not_analyzed",
"type": "string"
},
"parentid": {
"index": "not_analyzed",
"type": "string"
},
"date_groups": {
"properties": {
"conceptid": {
"index": "not_analyzed",
"type": "string"
}
}
},
"geometries": {
"type": "nested",
"properties": {
"businesstablename": {
"index": "not_analyzed",
"type": "string"
},
"entitytypeid": {
"index": "not_analyzed",
"type": "string"
},
"property": {
"index": "not_analyzed",
"type": "string"
},
"entityid": {
"index": "not_analyzed",
"type": "string"
},
"label": {
"index": "not_analyzed",
"type": "string"
},
"value": {
"type": "geo_shape"
},
"parentid": {
"index": "not_analyzed",
"type": "string"
}
}
},
"primaryname": {
"index": "not_analyzed",
"type": "string"
},
"property": {
"index": "not_analyzed",
"type": "string"
},
"value": {
"index": "not_analyzed",
"type": "string"
}
}

Cheers,
Alexei

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/76350f1a-8ff6-4aba-a964-a4ddaf59a123%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

FYI, you can also try a search using these coordinates (which are clearly
incorrect) in your filter, and it still returns a result.

"coordinates": [ -119, 35 ]

On Thursday, February 19, 2015 at 3:04:29 PM UTC-8, Alexei Peters wrote:

Hey Everyone,

I have a nested document that includes a spatial component that I'm using
in a spatial query via the geo_shape filter.
I've noticed that the filter consistently returns a result that includes a
geometry that clearly falls outside the spatial filter.
I've tested the spatial intersection in PostGIS and that correctly returns
back no result from the same query.

Can anyone else verify this? We have lots of other MultiPolygon data that
seems to work just fine.

I'm using the REST api against ES v1.4.1

Here's the document I'm testing against:

{"dates": [],
"geometries": [{
"value": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-118.32608,
34.07035],
[-118.32657,
34.07035],
[-118.32657,
34.07054],
[-118.32608,
34.07054],
[-118.32608,
34.07035]
]
],
[
[
[-118.32608,
34.07021],
[-118.32608,
34.07004],
[-118.32657,
34.07004],
[-118.32657,
34.07021],
[-118.32608,
34.07021]
]
]
]
},
"label": "MULTIPOLYGON (((-118.32608 34.07035,-118.32657
34.07035,-118.32657 34.07054,-118.32608 34.07054,-118.32608
34.07035)),((-118.32608 34.07021,-118.32608 34.07004,-118.32657
34.07004,-118.32657 34.07021,-118.32608 34.07021)))",
"child_entities": [],
"entitytypeid": "SPATIAL_COORDINATES_GEOMETRY.E47",
"parentid": "80446382-0e96-4db1-8a37-95aca166b785",
"entityid": "81b06621-2989-4825-98f3-88ee2ac937b6",
"property": "P87",
"businesstablename": "geometries"
}],
"child_entities": [{
"value": "Windsor Square District Non-Contributor",
"label": "Windsor Square District Non-Contributor",
"child_entities": [],
"entitytypeid": "NAME.E41",
"parentid": "5fbe787f-8fc3-4986-b77a-38828699b68c",
"entityid": "62a82362-b7c3-4ad2-ba58-29bab7dc5dbb",
"property": "P1",
"businesstablename": "strings"
}, {
"value": "",
"label": "",
"child_entities": [],
"entitytypeid": "PLACE.E53",
"parentid": "5fbe787f-8fc3-4986-b77a-38828699b68c",
"entityid": "80446382-0e96-4db1-8a37-95aca166b785",
"property": "P53",
"businesstablename": ""
}],
"label": "",
"date_groups": [],
"primaryname": "Windsor Square District Non-Contributor",
"value": "",
"entitytypeid": "HERITAGE_RESOURCE.E18",
"domains": [{
"conceptid": "a5675b84-fed4-4839-9afa-434be64c3899",
"child_entities": [],
"label": "Primary",
"value": "b171b37b-4c78-4b51-91a9-503541511be4",
"entitytypeid": "NAME_TYPE.E55",
"parentid": "62a82362-b7c3-4ad2-ba58-29bab7dc5dbb",
"entityid": "4bd86b01-a047-4e7a-953a-00d2243e39db",
"property": "P2",
"businesstablename": "domains"
}],
"entityid": "5fbe787f-8fc3-4986-b77a-38828699b68c",
"property": "",
"businesstablename": ""}

Here's the DSL:

{
"query": {
"filtered": {
"filter": {
"and": [
{
"bool": {
"should": [],
"must_not": [],
"must": [
{
"nested": {
"path": "geometries",
"query": {
"geo_shape": {
"geometries.value": {
"shape": {
"type": "Point",
"coordinates": [
-118.34194465228431,
34.06402964781424
]
}
}
}
}
}
}
]
}
}
]
},
"query": {
"match_all": {}
}
}
},
"from": 0,
"size": 5
}

Here's the mapping for the index:

"properties": {
"businesstablename": {
"index": "not_analyzed",
"type": "string"
},
"child_entities": {
"type": "nested",
"properties": {
"businesstablename": {
"index": "not_analyzed",
"type": "string"
},
"entitytypeid": {
"index": "not_analyzed",
"type": "string"
},
"property": {
"index": "not_analyzed",
"type": "string"
},
"entityid": {
"index": "not_analyzed",
"type": "string"
},
"label": {
"index": "not_analyzed",
"type": "string"
},
"value": {
"type": "string",
"fields": {
"raw": {
"index": "not_analyzed",
"type": "string"
},
"folded": {
"analyzer": "folding",
"type": "string"
}
}
},
"parentid": {
"index": "not_analyzed",
"type": "string"
}
}
},
"entitytypeid": {
"index": "not_analyzed",
"type": "string"
},
"domains": {
"type": "nested",
"properties": {
"businesstablename": {
"index": "not_analyzed",
"type": "string"
},
"entitytypeid": {
"index": "not_analyzed",
"type": "string"
},
"property": {
"index": "not_analyzed",
"type": "string"
},
"conceptid": {
"index": "not_analyzed",
"type": "string"
},
"entityid": {
"index": "not_analyzed",
"type": "string"
},
"label": {
"index": "not_analyzed",
"type": "string"
},
"value": {
"type": "string",
"fields": {
"raw": {
"index": "not_analyzed",
"type": "string"
}
}
},
"parentid": {
"index": "not_analyzed",
"type": "string"
}
}
},
"dates": {
"type": "nested",
"properties": {
"businesstablename": {
"index": "not_analyzed",
"type": "string"
},
"entitytypeid": {
"index": "not_analyzed",
"type": "string"
},
"property": {
"index": "not_analyzed",
"type": "string"
},
"entityid": {
"index": "not_analyzed",
"type": "string"
},
"label": {
"index": "not_analyzed",
"type": "string"
},
"value": {
"format": "dateOptionalTime",
"type": "date"
},
"parentid": {
"index": "not_analyzed",
"type": "string"
}
}
},
"entityid": {
"index": "not_analyzed",
"type": "string"
},
"label": {
"index": "not_analyzed",
"type": "string"
},
"parentid": {
"index": "not_analyzed",
"type": "string"
},
"date_groups": {
"properties": {
"conceptid": {
"index": "not_analyzed",
"type": "string"
}
}
},
"geometries": {
"type": "nested",
"properties": {
"businesstablename": {
"index": "not_analyzed",
"type": "string"
},
"entitytypeid": {
"index": "not_analyzed",
"type": "string"
},
"property": {
"index": "not_analyzed",
"type": "string"
},
"entityid": {
"index": "not_analyzed",
"type": "string"
},
"label": {
"index": "not_analyzed",
"type": "string"
},
"value": {
"type": "geo_shape"
},
"parentid": {
"index": "not_analyzed",
"type": "string"
}
}
},
"primaryname": {
"index": "not_analyzed",
"type": "string"
},
"property": {
"index": "not_analyzed",
"type": "string"
},
"value": {
"index": "not_analyzed",
"type": "string"
}
}

Cheers,
Alexei

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/04543e87-89ad-4b1c-803a-0210c0c1b727%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.