# Elasticsearch API not designed to be consumed directly by a front-end client?

**URL:** <https://discuss.elastic.co/t/elasticsearch-api-not-designed-to-be-consumed-directly-by-a-front-end-client/110546>\
**Category:** Elasticsearch\
**Created:** [December 6, 2017, 5:14pm UTC](https://discuss.elastic.co/t/elasticsearch-api-not-designed-to-be-consumed-directly-by-a-front-end-client/110546 "2017-12-06T17:14:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bradley](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@bradley](https://discuss.elastic.co/u/bradley)\
**Post date:** [December 6, 2017, 5:14pm UTC](https://discuss.elastic.co/t/elasticsearch-api-not-designed-to-be-consumed-directly-by-a-front-end-client/110546/1 "2017-12-06T17:14:16Z")

</div>

> <https://stackoverflow.com/questions/47603266/security-using-elasticsearch-and-x-pack-in-angular-2-5>

> It's possible, but not recommended. The Elasticsearch API is not designed to be consumed directly by a front end client, and the security constraints that are put in place within X-Pack do not aim to be secure within that environment. Elastic recommends that you communicate with Elasticsearch from a backend process.

This sounds pretty convincing, and I wonder if it's someone from the elastic team. If true, then then I don't understand why I haven't encountered this information anywhere else. I thought elasticsearch.js was intended to work on client and server. Also, Kibana consumes the API directly, right?

---

<div class="post-metadata">

**Author:** ![mujtabahussain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mujtabahussain/32/17514_2.png) [@mujtabahussain](https://discuss.elastic.co/u/mujtabahussain)\
**Post date:** [December 6, 2017, 9:19pm UTC](https://discuss.elastic.co/t/elasticsearch-api-not-designed-to-be-consumed-directly-by-a-front-end-client/110546/2 "2017-12-06T21:19:50Z")

</div>

> [@bradley](#):
>
> The Elasticsearch API is not designed to be consumed directly by a front end client

Elasticsearch has a REST API that returns data in JSON format. That API can be triggered by a variety of means and SDK's, the simplest of which is via `curl` on the command line. That data can be consumed by almost anything. I am not sure what that comment is implying or in what context!

> [@](#):
>
> security constraints that are put in place within X-Pack do not aim to be secure within that environment

Again, I am not sure I understand what the OP is trying to say here!

> [@](#):
>
> Elastic recommends that you communicate with Elasticsearch from a backend process.

My lack of understanding extends to this quote as well. Also, if elastic does recommend it, it would be handy to provide a link to where it does!

---

<div class="post-metadata">

**Author:** ![Mikhail\_Khludnev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikhail_khludnev/32/59591_2.png) [@Mikhail\_Khludnev](https://discuss.elastic.co/u/Mikhail_Khludnev)\
**Post date:** [December 8, 2017, 6:29am UTC](https://discuss.elastic.co/t/elasticsearch-api-not-designed-to-be-consumed-directly-by-a-front-end-client/110546/3 "2017-12-08T06:29:11Z")

</div>

> [@bradley](#):
>
> Also, Kibana consumes the API directly, right?

afaik, Kibana is a node-js (I'd say) _backend_ process, which talks to ES REST.

---

<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 5, 2018, 6:29am UTC](https://discuss.elastic.co/t/elasticsearch-api-not-designed-to-be-consumed-directly-by-a-front-end-client/110546/4 "2018-01-05T06:29:24Z")

</div>

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