Book Image

ElasticSearch Cookbook

By : Alberto Paro
Book Image

ElasticSearch Cookbook

By: Alberto Paro

Overview of this book

Table of Contents (20 chapters)
ElasticSearch Cookbook Second Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Getting node statistics via the API


The node statistics call API is used to collect real-time data of your node, such as memory usage, threads usage, the number of indexes, and searches.

Getting ready

You need a working ElasticSearch cluster.

How to do it...

To get nodes statistics, we will perform the following steps:

  1. To retrieve the node statistics, the HTTP method is GET and the curl command is:

    curl -XGET 'http://localhost:9200/_nodes/stats?all=true'
    curl -XGET 'http://localhost:9200/_nodes/<nodeId1>,<nodeId2>/stats?all=true'
    
  2. The result will be a long list of all the node statistics. The result is composed of the following:

    • A header describing the cluster name and the nodes section:

      {
        "cluster_name" : "es-cookbook",
        "nodes" : {
          "R3Gwu0a6Q9GTHPQ6cg95ZA" : {
            "timestamp" : 1406986967655,
            "name" : "Man-Ape",
            "transport_address" : "inet[/192.168.1.13:9300]",
            "host" : "Albertos-MacBook-Pro-2.local",
            "ip" : [ "inet[/192.168.1.13:9300]", "NONE" ],
    • Statistics...