# Problems setting up documents using geo\_point

**URL:** https://discuss.elastic.co/t/problems-setting-up-documents-using-geo-point/352618
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [February 6, 2024, 10:52am UTC](https://discuss.elastic.co/t/problems-setting-up-documents-using-geo-point/352618 "2024-02-06T10:52:58Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Dennis\_Christensen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dennis_christensen/32/97582_2.png) [@Dennis\_Christensen](https://discuss.elastic.co/u/Dennis_Christensen)
#### Post date: [February 6, 2024, 10:52am UTC](https://discuss.elastic.co/t/problems-setting-up-documents-using-geo-point/352618/1 "2024-02-06T10:52:58Z")

</div>

I am using C# Nest version 8, and have an Index of hotels with GeoLocation.

My document have the following property:

```auto
public GeoCoordinate geoCoordinate { get; set; }

```

When I try to do a geo search I end up with an empty array:

```auto
var result = await _client.SearchAsync<EHotel>(s => s
    .Index(HotelIndex)
    .Size(5000)
    .Query(q => q
        .GeoDistance(gd => gd
            .Field(f => f.geoCoordinate)
            .DistanceType(GeoDistanceType.Arc)
            .Location(coordinate)
            .Distance(distance, DistanceUnit.Kilometers)
        ))
    .Explain()
);

```

I've been searching a lot on the topic but seems I'm not able to find the a solution.

When I go to Kibana, the geoCoordinate property is a number and not a geo\_point.

Can someone help me how to solve this with nest?

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [February 6, 2024, 11:27am UTC](https://discuss.elastic.co/t/problems-setting-up-documents-using-geo-point/352618/2 "2024-02-06T11:27:34Z")

</div>

Have you created the mapping for your field before indexing any data?

Can you share your mappings? A `geo_point` field needs to be mapped before indexing any data on it.

---

<div class="post-metadata">

### Author: ![Dennis\_Christensen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dennis_christensen/32/97582_2.png) [@Dennis\_Christensen](https://discuss.elastic.co/u/Dennis_Christensen)
#### Post date: [February 6, 2024, 11:39am UTC](https://discuss.elastic.co/t/problems-setting-up-documents-using-geo-point/352618/3 "2024-02-06T11:39:49Z")

</div>

I could indeed be the case.

I'm not sure how to see the mappings in Nest 8.

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [February 6, 2024, 11:44am UTC](https://discuss.elastic.co/t/problems-setting-up-documents-using-geo-point/352618/4 "2024-02-06T11:44:18Z")

</div>

> [@Dennis\_Christensen](#):
>
> I'm not sure how to see the mappings in Nest 8.

I'm not sure how you would do it as well as I do not use it and I always set the mapping using templates, never directly on code.

But if you didn't created the mapping for the `geo_point` then it will not work as a `geo_point`, the mapping needs to be created before indexing the data.

You can read more about it [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html).

---

<div class="post-metadata">

### Author: ![Dennis\_Christensen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dennis_christensen/32/97582_2.png) [@Dennis\_Christensen](https://discuss.elastic.co/u/Dennis_Christensen)
#### Post date: [February 6, 2024, 11:54am UTC](https://discuss.elastic.co/t/problems-setting-up-documents-using-geo-point/352618/5 "2024-02-06T11:54:58Z")

</div>

I found a way to get the mapping, and you're right the mappings are wrong.

```auto
var response = _client.Indices.GetMapping<StringResponse>(m => m.Index(HotelIndex));
var index = response.Indices.FirstOrDefault();
var mapproperties = index.Value.Mappings.Properties;

```

I look into a way to create the index, and see if automap solves the issues.

Thanks for reaching 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: [March 5, 2024, 11:55am UTC](https://discuss.elastic.co/t/problems-setting-up-documents-using-geo-point/352618/6 "2024-03-05T11:55:52Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
