# ElasticSearch Query with Powershell Invoke-RestMethod

**URL:** <https://discuss.elastic.co/t/elasticsearch-query-with-powershell-invoke-restmethod/218228>\
**Category:** Elasticsearch\
**Created:** [February 6, 2020, 5:13pm UTC](https://discuss.elastic.co/t/elasticsearch-query-with-powershell-invoke-restmethod/218228 "2020-02-06T17:13:04Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [February 6, 2020, 8:18pm UTC](https://discuss.elastic.co/t/elasticsearch-query-with-powershell-invoke-restmethod/218228/3 "2020-02-06T20:18:52Z")

</div>

PowerShell doesn't support a GET request with a body, so you need to use POST instead as @dadoonet suggests.

If you need to work with Elasticsearch frequently with PowerShell, you may be interested in using [Elastic.Console](https://www.powershellgallery.com/packages/Elastic.Console/7.5.0-rc1), a small PowerShell module that provides cmdlets for

1. executing requests
2. API path autocompletion
3. ability to convert from and execute Kibana Console examples.

---

_[View the full topic](https://discuss.elastic.co/t/elasticsearch-query-with-powershell-invoke-restmethod/218228)._
