Skip to content

Error with geo_shape relation CONTAINS #17866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
glascaleia opened this issue Apr 19, 2016 · 5 comments · Fixed by #14810
Closed

Error with geo_shape relation CONTAINS #17866

glascaleia opened this issue Apr 19, 2016 · 5 comments · Fixed by #14810
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug v2.3.3

Comments

@glascaleia
Copy link

Hi all.
I have the following error trying to execute a spatial query with a ShapeRelation Contain.
aused by: java.lang.IllegalArgumentException:
at org.elasticsearch.index.query.GeoShapeQueryParser.getArgs(GeoShapeQueryParser.java:192)
at org.elasticsearch.index.query.GeoShapeQueryParser.parse(GeoShapeQueryParser.java:169)
at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:250)
at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:263)
at org.elasticsearch.index.query.IndexQueryParserService.parseInnerFilter(IndexQueryParserService.java:220)
at org.elasticsearch.search.query.PostFilterParseElement.parse(PostFilterParseElement.java:33)
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:838)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:654)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:620)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:371)

Regards

@eskibars
Copy link
Contributor

@glascaleia can you please post the query you're running that's giving you this error?

@glascaleia
Copy link
Author

{
"query" : {
"bool" : {
"must" : {
"geo_shape" : {
"mountainNowArea.location" : {
"shape" : {
"type" : "polygon",
"coordinates" : [ [ [ -4.21875, 25.482951175 ], [ 15.1171875, 27.994401411 ], [ 24.609375, 18.312810846 ], [ 23.5546875, 7.710991655 ], [ -7.03125, 12.897489184 ], [ -4.21875, 25.482951175 ] ] ]
},
"relation" : "contains"
},
"_name" : null
}
}
}
},
"sort" : [ {
"mountainNowArea.creationDate" : {
"order" : "desc"
}
} ]
}

@clintongormley clintongormley added >bug :Analytics/Geo Indexing, search aggregations of geo points and shapes v2.3.3 and removed feedback_needed labels Apr 20, 2016
@clintongormley
Copy link
Contributor

This fails for me on 2.3.0, but works on master. Full recreation:

PUT t 
{
  "mappings": {
    "t": {
      "properties": {
        "mountainNowArea": {
          "type": "object",
          "properties": {
            "location": {
              "type": "geo_shape"
            },
            "creationDate": {
              "type": "date"
            }
          }
        }
      }
    }
  }
}

PUT t/t/1
{
  "mountainNowArea": {
    "location": {
      "type": "polygon",
      "coordinates": [
        [
          [
            100,
            0
          ],
          [
            101,
            0
          ],
          [
            101,
            1
          ],
          [
            100,
            1
          ],
          [
            100,
            0
          ]
        ]
      ]
    },
    "creationDate": "2015-01-01"
  }
}

GET _search
{
  "query": {
    "bool": {
      "must": {
        "geo_shape": {
          "mountainNowArea.location": {
            "shape": {
              "type": "polygon",
              "coordinates": [
                [
                  [
                    -4.21875,
                    25.482951175
                  ],
                  [
                    15.1171875,
                    27.994401411
                  ],
                  [
                    24.609375,
                    18.312810846
                  ],
                  [
                    23.5546875,
                    7.710991655
                  ],
                  [
                    -7.03125,
                    12.897489184
                  ],
                  [
                    -4.21875,
                    25.482951175
                  ]
                ]
              ]
            },
            "relation": "contains"
          },
          "_name": null
        }
      }
    }
  },
  "sort": [
    {
      "mountainNowArea.creationDate": {
        "order": "desc"
      }
    }
  ]
}

@nknize
Copy link
Contributor

nknize commented May 6, 2016

@glascaleia what version of ES?

@clintongormley can you confirm the following exception?

"reason": "Failed to find geo_shape field [mountainNowArea.location]",

Can you confirm success when explicitly searching the t index? e.g.:

GET t/_search

This failure is unrelated to the original IAE issue. So it sounds to me like there are 2 separate issues.

@clintongormley
Copy link
Contributor

clintongormley commented May 18, 2016

Fixed by 26b078f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug v2.3.3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants