# How to make Elasticsearch API calls in Magento 2

**URL:** <https://discuss.elastic.co/t/how-to-make-elasticsearch-api-calls-in-magento-2/220831>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [February 25, 2020, 10:55am UTC](https://discuss.elastic.co/t/how-to-make-elasticsearch-api-calls-in-magento-2/220831 "2020-02-25T10:55:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tajveez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tajveez/32/46198_2.png) [@tajveez](https://discuss.elastic.co/u/tajveez)\
**Post date:** [February 25, 2020, 10:55am UTC](https://discuss.elastic.co/t/how-to-make-elasticsearch-api-calls-in-magento-2/220831/1 "2020-02-25T10:55:19Z")

</div>

Hi,

I have a custom search field from which I want to access elasticsearch results, for that, I am making API calls to

> URL:

`http://<my_url>:9200/_search` with

> body

```
    {
    "query": {
        "bool": {
            "must": [
                {
                    "query_string": {
                        "default_field": "_all",
                        "query": "white"
                    }
                }
            ],
            "must_not": [],
            "should": []
        }
    },
    "from": 0,
    "size": 10,
    "sort": [],
    "aggs": {}
}

```

this call is returning result in Postman, but it's not working when making calls from cURL, is there any other way of doing this?

---

<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:** [March 24, 2020, 10:55am UTC](https://discuss.elastic.co/t/how-to-make-elasticsearch-api-calls-in-magento-2/220831/2 "2020-03-24T10:55:32Z")

</div>

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