# Is there a way to access internal \_id and \_type fields in ES SQL query (XPack)?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-access-internal-id-and-type-fields-in-es-sql-query-xpack/174894>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [April 2, 2019, 12:15am UTC](https://discuss.elastic.co/t/is-there-a-way-to-access-internal-id-and-type-fields-in-es-sql-query-xpack/174894 "2019-04-02T00:15:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [April 4, 2019, 8:09am UTC](https://discuss.elastic.co/t/is-there-a-way-to-access-internal-id-and-type-fields-in-es-sql-query-xpack/174894/2 "2019-04-04T08:09:36Z")

</div>

Hi @j_bennet,

Indeed, this is not possible.

The reason is that in SQL, an user is able to search for columns (fields) that they know about and that they actually inserted in Elasticsearch. But the `_id` and the `_type` are not fields/columns that you actually put in an index, this is more like _meta_ information. And we bypass these fields in ES SQL by default.

For `_id` we have a [github issue](https://github.com/elastic/elasticsearch/issues/30266) created, but it's not on a concrete roadmap at the moment.

Also, if I may, I'd like to comment on a statement you made in your post - `even though this is still possible with a regular JSON query`: the aim of ES SQL is **not** to mirror the Elasticsearch functionality but with SQL commands. ES SQL is a subset of standard SQL functionality for Elasticsearch. The thinking around ES SQL starts from SQL side, not from Elasticsearch side: "implementing SQL functionality in Elasticsearch, and not vice versa".

---

_[View the full topic](https://discuss.elastic.co/t/is-there-a-way-to-access-internal-id-and-type-fields-in-es-sql-query-xpack/174894)._
