# GET data from ES in React

**URL:** <https://discuss.elastic.co/t/get-data-from-es-in-react/235943>\
**Category:** Elasticsearch\
**Created:** [June 5, 2020, 11:49am UTC](https://discuss.elastic.co/t/get-data-from-es-in-react/235943 "2020-06-05T11:49:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![raghav\_yadav](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raghav_yadav/32/45300_2.png) [@raghav\_yadav](https://discuss.elastic.co/u/raghav_yadav)\
**Post date:** [June 5, 2020, 11:49am UTC](https://discuss.elastic.co/t/get-data-from-es-in-react/235943/1 "2020-06-05T11:49:13Z")

</div>

If I have elasticsearch installed and running on my computer, then I can perform a GET request in my ReactJS app through the code below

```auto
const query = {
    "query": {
        "match_all": {}
      }
}

axios.get('http://localhost:9200/my-index/my-type/_search', {
  params: {
    source: JSON.stringify(query),
    source_content_type: 'application/json'
  }
}).then((res) => {
  console.log(res);
});

```

But, what API endpoint to call if I want to access data from an ES server?

---

<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 5, 2020, 11:49am UTC](https://discuss.elastic.co/t/get-data-from-es-in-react/235943/2 "2020-07-05T11:49:14Z")

</div>

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