Skip to content
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

How can I do geo point request #1539

Closed
daulet-sdn opened this issue Oct 11, 2021 · 2 comments
Closed

How can I do geo point request #1539

daulet-sdn opened this issue Oct 11, 2021 · 2 comments

Comments

@daulet-sdn
Copy link

daulet-sdn commented Oct 11, 2021

[ ] elastic.v7 (for Elasticsearch 7.x)

request like this:

{
  "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": {
        "geo_shape": {
          "location": {
            "shape": {
              "type": "point",
              "coordinates": [
                68.358335,
                51.815761
              ]
            },
            "relation": "contains"
          }
        }
      }
    }
  }
}

Thank you!

@olivere
Copy link
Owner

olivere commented Oct 11, 2021

@Grandapple You are looking for the Geo-shape query? It's not implemented yet. Here's the 1st reference.

Though it's not nice, you can always fall back to a RawStringQuery in such cases.

geoShapeQuery := elastic.RawStringQuery(`{"geo_shape": {
          "location": {
            "shape": {
              "type": "point",
              "coordinates": [
                68.358335,
                51.815761
              ]
            },
            "relation": "contains"
          }
        }`)

@olivere olivere closed this as completed Oct 11, 2021
@daulet-sdn
Copy link
Author

@olivere thanks a lot, you save my time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants