# Elasticsearch query

**URL:** <https://discuss.elastic.co/t/elasticsearch-query/350260>\
**Category:** Elasticsearch\
**Created:** [January 2, 2024, 7:13pm UTC](https://discuss.elastic.co/t/elasticsearch-query/350260 "2024-01-02T19:13:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bibhudutta\_Mohanty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bibhudutta_mohanty/32/119261_2.png) [@Bibhudutta\_Mohanty](https://discuss.elastic.co/u/Bibhudutta_Mohanty)\
**Post date:** [January 2, 2024, 7:13pm UTC](https://discuss.elastic.co/t/elasticsearch-query/350260/1 "2024-01-02T19:13:54Z")

</div>

I have a field called @editors in my index . It has multiple values like , i would like only show the last editor name in last\_editors field .  
I want to write a query where i can only fetch the the last editor name in each \_id(document)

The number of editors different in each document

1. "@editors": "sunny", "mandy", "krish"
2. "@editors": "sony"  
3."@editors": "maya", "firta"  
4."@editors": "riya", "viru", "mandy", "giri"

Please suggest me a query which can check if it is a single value it returns the value as it is if it is mutiple it will return the last value name in that field

---

<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:** [January 30, 2024, 7:14pm UTC](https://discuss.elastic.co/t/elasticsearch-query/350260/2 "2024-01-30T19:14:40Z")

</div>

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