elasticsearch.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sun, 12 Nov 2017 13:52:54 +0200
changeset 2203 c9cc487f54a3
parent 2202 37bf9f7b8560
child 2206 e765d2924785
permissions -rw-r--r--
Kibana plugins.


===============
 elasticsearch
===============
.. contents::
   :local:

REST syntax conventions
=======================

To get data in table form use ``/_cat`` endpoint::

  GET /_cat/nodes

To pretty print output append query::

  ?pretty=1

Get base information
====================

Cluster health::

  GET /_cat/health?v
  GET /_cluster/health?pretty
  GET /_cluster/health?pretty&level=cluster

List of nodes in cluster (ip, RAM, CPU)::

  GET /_cat/nodes?v
  GET /_cat/master?v

List cluster state::

  GET /_cluster/state?pretty

List of indexes (status, health, size)::

  GET /_cat/indices
  GET /_cat/indices?v
  GET /_cat/indices?v&s=index
  GET /_cluster/health?pretty&level=indices

List of mappings across all indexes::

  GET /_mapping
  GET /_all/_mapping

List of shards::

  GET /_cluster/health?pretty&level=shards

https://www.elastic.co/guide/en/elasticsearch/reference/current/_cluster_health.html
  Cluster Health.
https://www.elastic.co/guide/en/elasticsearch/reference/current/_list_all_indices.html
  List All Indices.
https://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html
  cat APIs.

Managing indexes
================

Assign number of shards and replicas::

  curl -XPUT -d '{settings: {index: "number_of_shards": 3, "number_of_replicas": 1}}'

https://www.elastic.co/guide/en/elasticsearch/reference/current/_delete_an_index.html
  Delete an Index.
https://github.com/elastic/curator
  Manage/archive indices.
https://www.elastic.co/guide/en/elasticsearch/client/curator/current/about.html
  Elasticsearch Curator helps you curate, or manage, your Elasticsearch indices and snapshots.
https://www.elastic.co/guide/en/elasticsearch/client/curator/current/about-features.html
  Curator allows for many different operations to be performed to both indices and snapshots.

https://www.elastic.co/guide/en/elasticsearch/guide/current/retiring-data.html
  Retiring Data.

Lucene search syntax
====================

``TERM1 TERM2`` is same as ``TERM1 OR TERM2``.

``"TERM1 TERM2"`` is for phrase.

``"TERM1 TERM2"~5`` is for proximity.

``TERM~0.8`` is for fuzzy.

``*`` is for wildcard.

Boosting is done with ``^N`` syntax, like ``TERM1^10 TERM2``.

Range with ``[2017-01-01 TO 2017-02-29]``.

Logical ``AND``, ``OR``, ``NOT`` and parentheses for grouping.

Fields are set before colon, like ``FIELD:TERM``.

https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-query-string-query.html
  Query String Query
https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-simple-query-string-query.html
  Simple Query String Query

Performance
===========

https://www.elastic.co/guide/en/elasticsearch/reference/5.5/search-profile.html
  Profile API.
https://www.elastic.co/guide/en/elasticsearch/reference/current/_explain_analyze.html
  Explain Analyze.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html
  Explain API.

https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-indexing-speed.html
  Tune for indexing speed.
https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-search-speed.html
  Tune for search speed.

JSON search syntax
==================

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html
  Search results pagination.
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html
  Query String Query.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html
  Aggregation.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html
  Sort.

Alerting
========

https://github.com/Yelp/elastalert
  Easy & Flexible Alerting With Elasticsearch.
http://elastalert.readthedocs.io/en/latest/elastalert.html
  Easy & Flexible Alerting With Elasticsearch.
https://github.com/sirensolutions/sentinl/wiki/SENTINL-Alerts-in-Dashboard
  SENTINL Alerts in Dashboard.
https://github.com/sirensolutions/sentinl/wiki/SENTINL-Config-Example
  SENTINL Config Example
https://github.com/sirensolutions/sentinl/wiki/SENTINL-Tutorial
  SENTINL Tutorial
https://github.com/sirensolutions/sentinl/wiki/SENTINL-Watcher-Anatomy
  SENTINL Watcher Anatomy
https://github.com/sirensolutions/sentinl/wiki/SENTINL-Watcher-Examples
  SENTINL Watcher Examples