Is there way to get JUST the version number for an Elasticsearch server. I know you get the JSON request data but is there a way to parse that request get the version number only.
curl localhost:9200
{
...
"version": {
...
"number": "2.1.1"
}
}
If you have the
jq
utility, you can use it to parse the json reply and output a plain text string:General purpose scripting languages can accomplish the same, but are usually more clunky:
Another way that doesn't require any outside dependencies is to use response filtering and the
filter_path
query string parameter (available since ES 1.6) and theawk
command.That returns: