SlideShare une entreprise Scribd logo
1  sur  7
Télécharger pour lire hors ligne
Elasticsearch 
Node 
It refers to a single running instance of Elasticsearch. 
 
Cluster [Database in RDBMS analogy] 
It is a collection of one or more nodes.  
 
Index [Table in RDBMS analogy] 
It is a collection of different types of documents and their properties. Index also uses 
the concept of shards to improve the performance. 
 
Document [Row in RDBMS analogy] 
It is a collection of fields in a specific manner defined in JSON format. Every document
                               
belongs to a type and resides inside an index. Every document is associated with a
                             
unique identifier called the UID. 
 
Shard 
Indexes are horizontally subdivided into shards. This means each shard contains all
                       
the properties of the document but contains less number of JSON objects than index.
                           
The horizontal separation makes shard an independent node, which can be store in
                         
any node. Primary shard is the original horizontal part of an index and then these
                             
primary shards are replicated into replica shards. 
 
Replicas 
Elasticsearch allows a user to create replicas of their indexes and shards. Replication
                         
not only helps in increasing the availability of data in case of failure, but also improves
                               
the performance of searching by carrying out a parallel search operation in these
                         
replicas. 
 
URLs 
Elasticsearch ​http://localhost:9200 
Kibana ​http://localhost:5601 
 
 
Syntax of REST API to query Elasticsearch using Query DSL (Domain Specific 
Language) 
 
<HTTP_VERB> <api>/<command> 
{ 
JSON Body 
} 
 
GET _cluster/health 
 
 
1. Create an Index 
PUT students 
{ 
"settings": { 
"index": { 
"number_of_shards": 1, 
"number_of_replicas": 0 
} 
} 
} 
 
2. Delete in Index 
DELETE students 
 
 
3. Add Documents one by one 
PUT /students/student/1 
{ 
"name": "Pratyush", 
"roll": 10, 
"city": "Gurgaon", 
"state": "Haryana", 
"desc": "Pratyush knows C, Java and PHP" 
} 
 
 
 
PUT /students/student/2 
{ 
"name": "Dushyant", 
"roll": 12, 
"city": "Rewari", 
"state": "Haryana", 
"desc": "Dushyant knows C and Java" 
} 
 
PUT /students/student/3 
{ 
"name": "Yogesh", 
"roll": 15, 
"city": "Bharatpur", 
"state": "Rajasthan", 
"desc": "Yogesh knows Java" 
} 
 
4. Bulk Add documents (Linux Command) 
curl -H "Content-Type: application/json" -XPOST 
"http://localhost:9200/students/_bulk" --data-binary "@students.json" 
 
5. View documents by Id 
GET /students/student/1 
 
6. Update a document 
PUT /students/student/1 
{ 
"name": "Pratyush Majumdar", 
"roll": 10, 
"city": "Gurgaon", 
"state": "Haryana" 
"desc": "Pratyush knows C, Java and PHP" 
} 
 
7. Get settings of any index 
GET /students/_settings 
 
 
 
 
 
 
Search API 
 
GET /students/_search 
{ 
"query":{ 
"match_all":{} 
} 
} 
 
GET students/student/_search 
{ 
"query":{ 
"query_string":{ 
"query":"Java" 
} 
} 
} 
 
GET /students/student/_search 
{ 
"query": { 
"query_string": { 
"default_field": "state", 
"query": "Haryana" 
} 
} 
} 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Completion Suggester 
 
1. Mapping query 
 
PUT phones 
{ 
"mappings": { 
"phone" : { 
"properties" : { 
"suggest" : { 
"type" : "completion" 
}, 
"title" : { 
"type": "keyword" 
} 
} 
} 
} 
} 
 
 
2. Add Data with input 
PUT phones/phone/1 
{ 
"name" : "Apple iPhone 12 pro max", 
"suggest" : { 
"input": [  
"Apple",  
"iPhone",  
"Apple iPhone", 
"iPhone 12", 
"pro max", 
"Apple iPhone 12 pro max" 
], 
"weight" : 12 
} 
} 
 
 
 
 
 
 
PUT phones/phone/2 
{ 
"name" : "Apple iPhone 11 pro max", 
"suggest" : { 
"input": [  
"Apple",  
"iPhone",  
"Apple iPhone", 
"iPhone 11", 
"pro max", 
"Apple iPhone 11 pro max" 
], 
"weight" : 11 
} 
} 
 
PUT phones/phone/3 
{ 
"name" : "Apple iPhone X", 
"suggest" : { 
"input": [  
"Apple",  
"iPhone",  
"Apple iPhone", 
"iPhone X", 
"Apple iPhone X" 
], 
"weight" : 10 
} 
} 
 
PUT phones/phone/4 
{ 
"name" : "Apple iPhone 9 Plus", 
"suggest" : { 
"input": [  
"Apple",  
"iPhone",  
"Apple iPhone", 
"iPhone 9", 
"9 Plus", 
"Apple iPhone 9 Plus" 
], 
"weight" : 9 
} 
} 
 
 
 
 
3. Search using prefix Match 
GET phones/_search 
{ 
"suggest": { 
"song-suggest" : { 
"prefix" : "i",  
"completion" : {  
"field" : "suggest" 
} 
} 
} 
} 
 
4. Search using prefix Match with Fuzzy-ness of 2 (For miss-spelling) 
GET phones/_search 
{ 
"suggest": { 
"song-suggest" : { 
"prefix" : "Appel",  
"completion" : {  
"field" : "suggest", 
"fuzzy" : { 
"fuzziness" : 2 
} 
} 
} 
} 
} 
 
 

Contenu connexe

Similaire à Elasticsearch

PostgreSQL, MongoDb, Express, React, Structured
PostgreSQL, MongoDb, Express, React, StructuredPostgreSQL, MongoDb, Express, React, Structured
PostgreSQL, MongoDb, Express, React, Structuredpriya951125
 
Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"George Stathis
 
Workshop: Learning Elasticsearch
Workshop: Learning ElasticsearchWorkshop: Learning Elasticsearch
Workshop: Learning ElasticsearchAnurag Patel
 
ElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersBen van Mol
 
ElasticSearch - index server used as a document database
ElasticSearch - index server used as a document databaseElasticSearch - index server used as a document database
ElasticSearch - index server used as a document databaseRobert Lujo
 
Using elasticsearch with rails
Using elasticsearch with railsUsing elasticsearch with rails
Using elasticsearch with railsTom Z Zeng
 
ElasticSearch Basic Introduction
ElasticSearch Basic IntroductionElasticSearch Basic Introduction
ElasticSearch Basic IntroductionMayur Rathod
 
Json to hive_schema_generator
Json to hive_schema_generatorJson to hive_schema_generator
Json to hive_schema_generatorPayal Jain
 
Getting started with Elasticsearch in .net
Getting started with Elasticsearch in .netGetting started with Elasticsearch in .net
Getting started with Elasticsearch in .netIsmaeel Enjreny
 
Getting Started With Elasticsearch In .NET
Getting Started With Elasticsearch In .NETGetting Started With Elasticsearch In .NET
Getting Started With Elasticsearch In .NETAhmed Abd Ellatif
 
Elasticsearch: An Overview
Elasticsearch: An OverviewElasticsearch: An Overview
Elasticsearch: An OverviewRuby Shrestha
 
Elasticsearch, a distributed search engine with real-time analytics
Elasticsearch, a distributed search engine with real-time analyticsElasticsearch, a distributed search engine with real-time analytics
Elasticsearch, a distributed search engine with real-time analyticsTiziano Fagni
 
FIWARE Global Summit - FIWARE Context Information Management
FIWARE Global Summit - FIWARE Context Information ManagementFIWARE Global Summit - FIWARE Context Information Management
FIWARE Global Summit - FIWARE Context Information ManagementFIWARE
 
Elastic search intro-@lamper
Elastic search intro-@lamperElastic search intro-@lamper
Elastic search intro-@lampermedcl
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQLLuca Garulli
 
About elasticsearch
About elasticsearchAbout elasticsearch
About elasticsearchMinsoo Jun
 

Similaire à Elasticsearch (20)

PostgreSQL, MongoDb, Express, React, Structured
PostgreSQL, MongoDb, Express, React, StructuredPostgreSQL, MongoDb, Express, React, Structured
PostgreSQL, MongoDb, Express, React, Structured
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"
 
Workshop: Learning Elasticsearch
Workshop: Learning ElasticsearchWorkshop: Learning Elasticsearch
Workshop: Learning Elasticsearch
 
No sql databases
No sql databasesNo sql databases
No sql databases
 
ElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersElasticSearch for .NET Developers
ElasticSearch for .NET Developers
 
ElasticSearch - index server used as a document database
ElasticSearch - index server used as a document databaseElasticSearch - index server used as a document database
ElasticSearch - index server used as a document database
 
Using elasticsearch with rails
Using elasticsearch with railsUsing elasticsearch with rails
Using elasticsearch with rails
 
ElasticSearch Basic Introduction
ElasticSearch Basic IntroductionElasticSearch Basic Introduction
ElasticSearch Basic Introduction
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
Json to hive_schema_generator
Json to hive_schema_generatorJson to hive_schema_generator
Json to hive_schema_generator
 
Getting started with Elasticsearch in .net
Getting started with Elasticsearch in .netGetting started with Elasticsearch in .net
Getting started with Elasticsearch in .net
 
Getting Started With Elasticsearch In .NET
Getting Started With Elasticsearch In .NETGetting Started With Elasticsearch In .NET
Getting Started With Elasticsearch In .NET
 
The Glory of Rest
The Glory of RestThe Glory of Rest
The Glory of Rest
 
Elasticsearch: An Overview
Elasticsearch: An OverviewElasticsearch: An Overview
Elasticsearch: An Overview
 
Elasticsearch, a distributed search engine with real-time analytics
Elasticsearch, a distributed search engine with real-time analyticsElasticsearch, a distributed search engine with real-time analytics
Elasticsearch, a distributed search engine with real-time analytics
 
FIWARE Global Summit - FIWARE Context Information Management
FIWARE Global Summit - FIWARE Context Information ManagementFIWARE Global Summit - FIWARE Context Information Management
FIWARE Global Summit - FIWARE Context Information Management
 
Elastic search intro-@lamper
Elastic search intro-@lamperElastic search intro-@lamper
Elastic search intro-@lamper
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQL
 
About elasticsearch
About elasticsearchAbout elasticsearch
About elasticsearch
 

Plus de Pratyush Majumdar

Plus de Pratyush Majumdar (7)

An Introduction to Pagespeed Optimisation
An Introduction to Pagespeed OptimisationAn Introduction to Pagespeed Optimisation
An Introduction to Pagespeed Optimisation
 
Aws Architecture Training
Aws Architecture TrainingAws Architecture Training
Aws Architecture Training
 
CrUx Report and Improving Web vitals
CrUx Report and Improving Web vitalsCrUx Report and Improving Web vitals
CrUx Report and Improving Web vitals
 
Selenium Automation
Selenium AutomationSelenium Automation
Selenium Automation
 
Making app cluster ready
Making app cluster readyMaking app cluster ready
Making app cluster ready
 
SEI CMMI presentation
SEI CMMI presentationSEI CMMI presentation
SEI CMMI presentation
 
Apache architecture
Apache architectureApache architecture
Apache architecture
 

Dernier

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 

Dernier (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Boksburg [(+27832195400*)] 🏥 Women's Abortion Clinic in ...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 

Elasticsearch

  • 1. Elasticsearch  Node  It refers to a single running instance of Elasticsearch.    Cluster [Database in RDBMS analogy]  It is a collection of one or more nodes.     Index [Table in RDBMS analogy]  It is a collection of different types of documents and their properties. Index also uses  the concept of shards to improve the performance.    Document [Row in RDBMS analogy]  It is a collection of fields in a specific manner defined in JSON format. Every document                                 belongs to a type and resides inside an index. Every document is associated with a                               unique identifier called the UID.    Shard  Indexes are horizontally subdivided into shards. This means each shard contains all                         the properties of the document but contains less number of JSON objects than index.                             The horizontal separation makes shard an independent node, which can be store in                           any node. Primary shard is the original horizontal part of an index and then these                               primary shards are replicated into replica shards.    Replicas  Elasticsearch allows a user to create replicas of their indexes and shards. Replication                           not only helps in increasing the availability of data in case of failure, but also improves                                 the performance of searching by carrying out a parallel search operation in these                           replicas.   
  • 2. URLs  Elasticsearch ​http://localhost:9200  Kibana ​http://localhost:5601      Syntax of REST API to query Elasticsearch using Query DSL (Domain Specific  Language)    <HTTP_VERB> <api>/<command>  {  JSON Body  }    GET _cluster/health      1. Create an Index  PUT students  {  "settings": {  "index": {  "number_of_shards": 1,  "number_of_replicas": 0  }  }  }    2. Delete in Index  DELETE students      3. Add Documents one by one  PUT /students/student/1  {  "name": "Pratyush",  "roll": 10,  "city": "Gurgaon",  "state": "Haryana",  "desc": "Pratyush knows C, Java and PHP"  }       
  • 3. PUT /students/student/2  {  "name": "Dushyant",  "roll": 12,  "city": "Rewari",  "state": "Haryana",  "desc": "Dushyant knows C and Java"  }    PUT /students/student/3  {  "name": "Yogesh",  "roll": 15,  "city": "Bharatpur",  "state": "Rajasthan",  "desc": "Yogesh knows Java"  }    4. Bulk Add documents (Linux Command)  curl -H "Content-Type: application/json" -XPOST  "http://localhost:9200/students/_bulk" --data-binary "@students.json"    5. View documents by Id  GET /students/student/1    6. Update a document  PUT /students/student/1  {  "name": "Pratyush Majumdar",  "roll": 10,  "city": "Gurgaon",  "state": "Haryana"  "desc": "Pratyush knows C, Java and PHP"  }    7. Get settings of any index  GET /students/_settings             
  • 4. Search API    GET /students/_search  {  "query":{  "match_all":{}  }  }    GET students/student/_search  {  "query":{  "query_string":{  "query":"Java"  }  }  }    GET /students/student/_search  {  "query": {  "query_string": {  "default_field": "state",  "query": "Haryana"  }  }  }                                 
  • 5. Completion Suggester    1. Mapping query    PUT phones  {  "mappings": {  "phone" : {  "properties" : {  "suggest" : {  "type" : "completion"  },  "title" : {  "type": "keyword"  }  }  }  }  }      2. Add Data with input  PUT phones/phone/1  {  "name" : "Apple iPhone 12 pro max",  "suggest" : {  "input": [   "Apple",   "iPhone",   "Apple iPhone",  "iPhone 12",  "pro max",  "Apple iPhone 12 pro max"  ],  "weight" : 12  }  }             
  • 6. PUT phones/phone/2  {  "name" : "Apple iPhone 11 pro max",  "suggest" : {  "input": [   "Apple",   "iPhone",   "Apple iPhone",  "iPhone 11",  "pro max",  "Apple iPhone 11 pro max"  ],  "weight" : 11  }  }    PUT phones/phone/3  {  "name" : "Apple iPhone X",  "suggest" : {  "input": [   "Apple",   "iPhone",   "Apple iPhone",  "iPhone X",  "Apple iPhone X"  ],  "weight" : 10  }  }    PUT phones/phone/4  {  "name" : "Apple iPhone 9 Plus",  "suggest" : {  "input": [   "Apple",   "iPhone",   "Apple iPhone",  "iPhone 9",  "9 Plus",  "Apple iPhone 9 Plus"  ], 
  • 7. "weight" : 9  }  }          3. Search using prefix Match  GET phones/_search  {  "suggest": {  "song-suggest" : {  "prefix" : "i",   "completion" : {   "field" : "suggest"  }  }  }  }    4. Search using prefix Match with Fuzzy-ness of 2 (For miss-spelling)  GET phones/_search  {  "suggest": {  "song-suggest" : {  "prefix" : "Appel",   "completion" : {   "field" : "suggest",  "fuzzy" : {  "fuzziness" : 2  }  }  }  }  }