# Indexing a Circle (geoshape) Using NEST

**URL:** <https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [April 3, 2022, 10:45am UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421 "2022-04-03T10:45:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![xef](https://avatars.discourse-cdn.com/v4/letter/x/898d66/32.png) [@xef](https://discuss.elastic.co/u/xef)\
**Post date:** [April 3, 2022, 10:45am UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/1 "2022-04-03T10:45:51Z")

</div>

Is there anyway of Indexing a Circle i.e. just have the lat/lng and a radius without first having to create a geojson polygon that represents it. i.e. just using its center lat/lng and its radius.  
Thanks.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 3, 2022, 11:44am UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/2 "2022-04-03T11:44:12Z")

</div>

Circles need to be indexed as polygons.  
But you can use the [Circle processor | Elasticsearch Guide [8.1] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest-circle-processor.html) to make your life easier.

---

<div class="post-metadata">

**Author:** ![xef](https://avatars.discourse-cdn.com/v4/letter/x/898d66/32.png) [@xef](https://discuss.elastic.co/u/xef)\
**Post date:** [April 3, 2022, 12:50pm UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/3 "2022-04-03T12:50:01Z")

</div>

Thanks for your response.  
Are there any examples using NEST api when indexing a whole document that has such a field?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 3, 2022, 3:05pm UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/4 "2022-04-03T15:05:11Z")

</div>

No idea.

But from Nest it should be just a normal Index operation with a pipeline.

---

<div class="post-metadata">

**Author:** ![xef](https://avatars.discourse-cdn.com/v4/letter/x/898d66/32.png) [@xef](https://discuss.elastic.co/u/xef)\
**Post date:** [April 3, 2022, 7:20pm UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/5 "2022-04-03T19:20:10Z")

</div>

For example this is how we index a document in NEST:

` var result = await ElasticSearchConfig.GetClient().IndexAsync(loc, idx => idx.Index("localities"));;`

Where does the processor come into play. We just cannot figure out how to use it? Any chance of one of your NEST guys having a look at this? Thanks.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 3, 2022, 7:42pm UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/6 "2022-04-03T19:42:04Z")

</div>

I believe you could use.

```
.Pipeline("Pipeline name")

```

Found that from [Indexing documents | Elasticsearch .NET Client [8.1] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/indexing-documents.html#_multiple_documents_with_bulk)

---

<div class="post-metadata">

**Author:** ![xef](https://avatars.discourse-cdn.com/v4/letter/x/898d66/32.png) [@xef](https://discuss.elastic.co/u/xef)\
**Post date:** [April 3, 2022, 8:17pm UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/7 "2022-04-03T20:17:51Z")

</div>

But we are only indexing a single document and we want to generate the polygon from a circles's center and radius. In the above indexing code which I wrote, is there anyway to achieve this? Thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 4, 2022, 1:01am UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/8 "2022-04-04T01:01:40Z")

</div>

Did you try to define an ingest pipeline and call it at index time as I explained?

---

<div class="post-metadata">

**Author:** ![xef](https://avatars.discourse-cdn.com/v4/letter/x/898d66/32.png) [@xef](https://discuss.elastic.co/u/xef)\
**Post date:** [April 4, 2022, 2:19am UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/9 "2022-04-04T02:19:05Z")

</div>

Hi. Yes thanks for the tip. We created an ingest pipeline as you said.  
However, we cannot figure out how the Cicle processor creates the circle as there is no parameters we can pass for the radius or the center of the circle.

---

<div class="post-metadata">

**Author:** ![xef](https://avatars.discourse-cdn.com/v4/letter/x/898d66/32.png) [@xef](https://discuss.elastic.co/u/xef)\
**Post date:** [April 4, 2022, 2:59am UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/10 "2022-04-04T02:59:03Z")

</div>

Hi. I think we finally got it.  
Thanks you very much.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 4, 2022, 5:33am UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/11 "2022-04-04T05:33:02Z")

</div>

Great. Adding this piece of code from the documentation so future readers will have it:

```auto
PUT circles/_doc/1?pipeline=polygonize_circles
{
  "circle": "CIRCLE (30 10 40)"
}

```

---

<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:** [May 2, 2022, 5:33am UTC](https://discuss.elastic.co/t/indexing-a-circle-geoshape-using-nest/301421/12 "2022-05-02T05:33:34Z")

</div>

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