If you're running on Windows with at least PowerShell 3.0+, you can always give the Elastic.Console
PowerShell module a try. It provides a curl-like experience in PowerShell with API path and method completion
To install in PowerShell from the PowerShell gallery
Install-Module Elastic.Console -AllowPrerelease
Upon installation, the module will be configured with the APIs matching the version returned from
Get-ElasticsearchVersion
If you want to run with a different version of APIs, you can set this with
Set-ElasticsearchVersion 7.6.2
If not already downloaded, this will download the REST API specs of 7.6.2 version, which are used to power autocompletion.
Then, to make an API call
Invoke-Elasticsearch http://localhost:9200/inspections/_doc/_search -Body @'
{ "query": { "match": { "business_name": "soup" } }}
'@
es
is an alias for Invoke-Elasticsearch
, and http://localhost:9200
is the default protocol, host and port, so this can be shortened to
es inspections/_doc/_search -Body @'
{ "query": { "match": { "business_name": "soup" } }}
'@