# Select Element from Array by Index trough {{path}}

**URL:** <https://discuss.elastic.co/t/select-element-from-array-by-index-trough-path/88681>\
**Category:** Elasticsearch\
**Created:** [June 8, 2017, 8:05am UTC](https://discuss.elastic.co/t/select-element-from-array-by-index-trough-path/88681 "2017-06-08T08:05:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidS](https://avatars.discourse-cdn.com/v4/letter/d/65b543/32.png) [@davidS](https://discuss.elastic.co/u/davidS)\
**Post date:** [June 8, 2017, 8:05am UTC](https://discuss.elastic.co/t/select-element-from-array-by-index-trough-path/88681/1 "2017-06-08T08:05:50Z")

</div>

Hi,

how can I select a specified element from an arry by there index in a {{path}}-Expression like

{{ctx.payload.hits.hits[0].field}}.

I read that it could be referenced by there idx directly like {{ctx.payload.hits.hits.0.field}}, but it does not work.

I am using Elasticsearch 5.4 with XPack

Best regards

David

---

<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:** [July 6, 2017, 8:05am UTC](https://discuss.elastic.co/t/select-element-from-array-by-index-trough-path/88681/2 "2017-07-06T08:05:55Z")

</div>

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