DevOps Classroom Series – 20/Sept/2021

Mappings and Datatypes

  • Elastic search supports wide variety of data types
    • Core datatypes:
      • String datatypes:
        • text: The text data type is useful for supporting full-text search for fields that contain a description or lengthy text values.
        • keyword: The keyword type enables analytics on string fields to support sorting, filtering and aggregations
      • Numeric datatypes:
        • byte (8), short (16),integer(32) and long(64)
        • float (32) and double (64)
        • half_float (16)
        • scaled_float
      • Date Datatype
        • date
      • Boolean datatype
        • boolean
      • Binary data type:
        • binary
      • Range datatypes
        • integer_range, float_range, long_range, double_range and date_range
    • Complex datatypes
      • Array datatype
      • Object datatype
      • Nested datatype
    • Other datatypes:
      • Geo-point
      • Geo-shape
      • Ip datatype
  • Get a mapping for the index
  • Lets create an index dummyproducts with some mapping
  • Now create a document in the dummy products with extra fields not specified in mapping
  • Now lets get mapping for dummy products
  • Lets try to update mappings Refer Here

Inverted Index

  • An inverted index is the core data structure of Elastic search.
  • Lets assume we have following documents created
Document ID Document
1 Today is Monday
2 Monday is starting day of the week
3 Saturday and Sunday are holidays
  • Elastic search builds a data structure from the above three documents which is called as inverted index
  • When searching for terms in documents, it fast to locate the documents in which given term appears and inverted index is created.
  • By default Elastic search builds an inverted index on all the fields in the document

CRUD Operations

  • To understand how to perform CRUD operations lets try to understand the following APIs
    • Index API
    • Get API
    • Update API
    • Delete API

Index API

  • In Elastic search terminology, adding a document to a type with in an index is called indexing operation.
  • We have already learnt, indexing involves
    • adding the document to the index by parsing all the fields within the document
    • building an inverted index
  • There are two ways we can index a document
    • Indexing a document with ID
    • Indexing a document without provding ID

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Plugin for Social Media by Acurax Wordpress Design Studio
Exit mobile version
%%footer%%