# Rename fields in the search output

**URL:** <https://discuss.elastic.co/t/rename-fields-in-the-search-output/196850>\
**Category:** Elasticsearch\
**Created:** [August 26, 2019, 11:43pm UTC](https://discuss.elastic.co/t/rename-fields-in-the-search-output/196850 "2019-08-26T23:43:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![arsenmk](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@arsenmk](https://discuss.elastic.co/u/arsenmk)\
**Post date:** [August 26, 2019, 11:43pm UTC](https://discuss.elastic.co/t/rename-fields-in-the-search-output/196850/1 "2019-08-26T23:43:42Z")

</div>

Is there a way to rename the fields in the output similar to how you can do field aliases in SQL, e.g.: "SELECT lastname AS surname FROM people" ? Note, I want only the output be changed, not the stored fields or any mapping.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [August 27, 2019, 2:47am UTC](https://discuss.elastic.co/t/rename-fields-in-the-search-output/196850/2 "2019-08-27T02:47:48Z")

</div>

Well as a mater of fact you can use SQL syntax and do exactly that

See [Here](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-syntax-select.html)

---

<div class="post-metadata">

**Author:** ![arsenmk](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@arsenmk](https://discuss.elastic.co/u/arsenmk)\
**Post date:** [August 27, 2019, 4:24pm UTC](https://discuss.elastic.co/t/rename-fields-in-the-search-output/196850/3 "2019-08-27T16:24:35Z")

</div>

@stephenb, any chance I can achieve that with DSL? I do not want to use x-pack :))

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [August 28, 2019, 12:12am UTC](https://discuss.elastic.co/t/rename-fields-in-the-search-output/196850/4 "2019-08-28T00:12:15Z")

</div>

SQL is part of the Basic / default / free distribution (i.e if you just downloaded the normal version it is there) yes docs say xpack in this case just means not the in the OSS version but I also understand if you want to use the pure OSS version.

[https://www.elastic.co/subscriptions](https://www.elastic.co/subscriptions)

I do not believe there is simple way to do this you could create [field alias](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/alias.html) or do at the application level.

---

<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:** [September 25, 2019, 12:12am UTC](https://discuss.elastic.co/t/rename-fields-in-the-search-output/196850/5 "2019-09-25T00:12:16Z")

</div>

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