Executing Searches : Query DSL: Windows Server 2019

Hi there I am busy learning Elasticsearch through the Udemy course Elasticsearch 7 and the Elastic Stack - In Depth & Hands On. It is Linux based but I am also running ElasticSearch on Windows Server 2019.

I ran this query successfully on Ubuntu and Fedora,

curl -H "Content-Type:application/json" -XGET '127.0.0.1:9200/shakespeare/_search?pretty' -d '
{
"query" : {
"match_phrase" : {
"text_entry" : "to be or not to be"
}
}
}'

then I tried running it on Windows to no avail, I installed Powershell 6 in order to use that version of cURL, did not work, installed the cURL X64 binary but it has an issue with the syntax, it seems that you can use Invoke-webrequest on Powershell, but there are no examples as how to do it on the Elastic site. I would love to be able to implement and query from the command shell and using scripts my index on Windows as well.

If anybody can point me to examples of "normal" bash cURL based queries and using XPUT, XPOST etc., to a Windows-based command-line solution I will be grateful.

You may be interested in Elastic.Console, a small PowerShell module for executing requests against Elasticsearch using PowerShell. One function in particular, ConvertFrom-KibanaConsole can take Kibana console examples as strings and execute them against Elasticsearch. Also check out the GitHub repository and built-in PowerShell help for more details and examples

1 Like

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