Elasticsearch: Introduction

Han Yi

March 27, 2018

Elasticsearch

ElasticSearch

Elastic Search

Elastic search

ūüĎć

ūüĎé

...

Common Misconception

Basic Concepts

Elasticsearch  vs  RDBMS

Index

 

Type

 

Document

 

Field

Row

 

Database

 

Table

 

Column

Basic Concepts

Elasticsearch  vs  RDBMS

Index

 

Type

 

Document

 

Field

Row

 

Database

 

Table

 

Column

Steps for removal of mapping types

  • 6.x
    • may only contain a single mapping type
    • _doc is preferred for single type case
  • 7.x
    • type is deprecated
    • include_type_name is added and give warning message if not set to false (default is true and ES will use _doc)
  • 8.x
    • type is removed
    • include_type_name is deprecated
  • 9.x
    • include_type_name is removed

RESTful API: A Glimpse

  • API Categories
    • Document API: CRUD, Bulk, Reindex, etc
    • Search API: URI/DSL Query, Suggester, Aggregation, etc
    • Indices API: CRUD, indices operations, etc
    • Cat API: pretty print index data
    • Cluster API: manager clusters
  • API Example
PUT prdts/_doc/1
{

  "title": "coat",
  "price": "15"
}
{
    "_index": "prdts",
    "_type": "_doc",
    "_id": "1",
    "_version": 1,
    "result": "created",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "_seq_no": 0,
    "_primary_term": 1
}

RESTful API: A Glimpse

  • API Example
GET prdts/_doc/1
{
    "_index": "prdts",
    "_type": "_doc",
    "_id": "1",
    "_version": 1,
    "found": true,
    "_source": {
        "title": "coat",
        "price": "15"
    }
}

RESTful API: A Glimpse

  • API Example
POST prdts/_doc/1/_update
{
    "doc": {
        "price": "20"
    }
}
{
    "_index": "prdts",
    "_type": "_doc",
    "_id": "1",
    "_version": 2,
    "result": "updated",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "_seq_no": 1,
    "_primary_term": 1
}

RESTful API: A Glimpse

  • API Example
DELETE prdts/_doc/1
{
    "_index": "prdts",
    "_type": "_doc",
    "_id": "1",
    "_version": 3,
    "result": "deleted",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "_seq_no": 2,
    "_primary_term": 1
}

RESTful API: A Glimpse

  • GET _cluster/health
    • Green
      • all shards are allocated
    • Yellow
      • the primary shard is allocated but replicas are not
    • Red
      • the specific shard is not allocated in the cluster

RESTful API: A Glimpse

Elasticsearch Principles

  • Full text search engine based on Apache Lucene

Elasticsearch Principles

  • Distributed Search Engine

Elasticsearch Principles

  • Node types

Elasticsearch Principles

  • Node types (Continued)
    • Master-eligible node
      • default: true
    • Data node
      • default: true
    • Ingest node
      • default: true
    • Tribe node (deprecated)
    • Client node (Coordinating only node)
      • All above options are false

Features: Scalability and Availability

  • Shard (Example 1)

Features: Scalability and Availability

  • Shard (Example 2)

Features: Scalability and Availability

  • ReplicaSet (Example 3)
  • Distributed Query

Features: Scalability and Availability

  • Fault Processing (1)

Features: Scalability and Availability

Scalability and Availability

  • Fault Processing (2)

Scalability and Availability

  • Fault Processing (3)

Thanks

Elasticsearch: Introduction

By hanyi8000

Elasticsearch: Introduction

  • 1,213