# Create a geo-shape document from several other location documents

**URL:** <https://discuss.elastic.co/t/create-a-geo-shape-document-from-several-other-location-documents/182921>\
**Category:** Elasticsearch\
**Created:** [May 27, 2019, 1:34pm UTC](https://discuss.elastic.co/t/create-a-geo-shape-document-from-several-other-location-documents/182921 "2019-05-27T13:34:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)\
**Post date:** [May 27, 2019, 1:34pm UTC](https://discuss.elastic.co/t/create-a-geo-shape-document-from-several-other-location-documents/182921/1 "2019-05-27T13:34:51Z")

</div>

Hello,

I get several documents with a location inside. At the end of a period, I want to collect all the locations to create a new document which will be the route of those points (linestring)

How can I do that? Pipelines seems to alter the document itself and watcher seems to have basic actions (except webhook).

Is there a simple way or a snippet for that?

best

---

<div class="post-metadata">

**Author:** ![talevy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talevy/32/44896_2.png) [@talevy](https://discuss.elastic.co/u/talevy)\
**Post date:** [May 28, 2019, 3:21pm UTC](https://discuss.elastic.co/t/create-a-geo-shape-document-from-several-other-location-documents/182921/2 "2019-05-28T15:21:29Z")

</div>

Hi Dao,

I do not know of any great ways to do this as of now. We are working on a new aggregation called `geo_line`, which will create a line-string from a bucket of points: [https://github.com/elastic/elasticsearch/pull/41612](https://github.com/elastic/elasticsearch/pull/41612).

Another option you can explore for the interim is to use a top-hits aggregation (which is limited to number of results) within a watch to fetch some points for a specific time period together sorted and then create a new document with that data.

---

<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:** [June 25, 2019, 3:22pm UTC](https://discuss.elastic.co/t/create-a-geo-shape-document-from-several-other-location-documents/182921/3 "2019-06-25T15:22:02Z")

</div>

Closed on June 25, 2019, 3:22pm UTC

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