Monthly Archives: May 2022

Getting ElasticSearch Node Versions

Kibana doesn’t tell you what version your nodes are currently running which can be frustrating if you get distracted during an upgrade process. Here is a simple PowerShell script that gets all the nodes and their current version.

$cred = Get-Credential
$nodes_raw = Invoke-RestMethod -Method Get -Uri "http://elasticsearch:9200/_nodes" -Credential $cred

#get the names of each node
$node_names = $nodes_raw.nodes | Get-Member -MemberType NoteProperty | Select -ExpandProperty Name

#convert from object properties to an array of objects
$nodes = foreach ($node_name in $node_names) {

# Select desired info about the node
$nodes | select name, version

Grafana Elasticsearch Moving Averages

Adding moving averages to a graph of Elasticsearch data in grafana is pretty easy, but not well documented

  1. Add a new metric
  2. Choose MovingFunction and pick the metric you want an average on
  3. Expand the options, set Window to the number of samples you want to have your moving function on
  4. Script should be one of the following:
    1. MovingFunctions.max(values)
    2. MovingFunctions.min(values)
    3. MovingFunctions.sum(values)
    4. MovingFunctions.unweightedAvg(values)
    5. MovingFunctions.linearWeightedAvg(values)