0

I am attempting to create a custom script.

_source": {
                "_boost": "1.5",
                "bid": "60697",
                "name": "Brick",
                "address": "3095 33rd St",
                "city": "Astoria",
                "state": "NY",
                "zip": "11103",
                "tags": "Restaurant,Italian",
                "location": [
                    {
                        "lat": 40.76359,
                        "lon": -73.921684
                    }
                ]}

I am tryin to retrieve the lat and lon fields in Java using the DocLookup class. Usually I would just do doc().field("name") to get, for example, the name.

How would I go about getting the lat and lon in a custom script given my document structure?

1 Answer 1

1
double[] lats = ((GeoPointDocFieldData) doc().field("name")).getLats();
double[] lons = ((GeoPointDocFieldData) doc().field("name")).getLons();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.