SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Elasticsearch and MIT Sloan Data Analytics Hackathon
Cambridge, MA - May 10, 2014
Elasticsearch
Quick Introduction
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
About Me
• Igor Motov
• Developer at Elasticsearch Inc.
• Github: imotov
• Twitter: @imotov
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
About Elasticsearch Inc.
• Founded in 2012
By the people behind the Elasticsearch and Apache Lucene
http://www.elasticsearch.com
Headquarters: Amsterdam and Los Altos, CA
• We provide
Training (public & onsite)
Development support
Production support subscription (SLA)
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
About Elasticsearch
• Real time search and analytics engine
JSON-oriented, Apache Lucene-based
• Automatic Schema Detection
Enables control of it when needed
• Distributed
Scales Up+Out, Highly Available
• Multi-tenancy
Dynamically create/delete indices
• API centric
Most functionality is exposed through an API
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Basic Concepts
• Cluster
a group of nodes sharing the same set of indices
• Node
a running Elasticsearch instance (typically JVM process)
• Index
a set of documents of possibly different types
stored in one or more shards
• Type
a set of documents in an index that share the same schema
• Shard
a Lucene index, allocated on one of the nodes
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Basic Concepts - Document
• JSON Object
!
!
!
!
!
!
• Identified by index/type/id
{
"rank": 21,
"city": "Boston",
"state": "Massachusetts",
"population2010": 617594,
"land_area": 48.277,
"density": 12793,
"ansi": 619463,
"location": {
"lat": 42.332,
"lon": 71.0202
},
"abbreviation": "MA"
}
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Downloading elasticsearch
• http://www.elasticsearch.org/download/
Windows Everything else
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
What’s in a distribution?
.
├── LICENSE.txt
├── NOTICE.txt
├── README.textile
├── bin
│   ├── elasticsearch
│   ├── elasticsearch.in.sh
│   └── plugin
├── config
│   ├── elasticsearch.yml
│   └── logging.yml
├── data
│   └── elasticsearch
├── lib
│   ├── elasticsearch-x.y.z.jar
│   ├── ...
│   └──
└── logs
   ├── elasticsearch.log
   └── elasticsearch_index_search_slowlog.log
executable scripts
node config files
data storage
libs
log files
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Configuration (multicast)
• Configuration config/elasticsearch.yml
cluster.name: "elasticsearch-imotov"
unique	

name
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Configuration (stand-alone)
• Configuration config/elasticsearch.yml
cluster.name: "elasticsearch-imotov"
network.host: "127.0.0.1"
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301", “localhost:9302"]
unique	

name
listen only	

on localhost
disable	

multicast
search for other	

nodes on localhost
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Starting elasticsearch
• Foreground
!
!
• Background
$ bin/elasticsearch
$ bin/elasticsearch -d
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Is it running?
{
"status" : 200,
"name" : "Kamal",
"version" : {
"number" : "1.1.1",
"build_hash" : "f1585f096d3f3985e73456debdc1a0745f512bbc",
"build_timestamp" : "2014-04-16T14:27:12Z",
"build_snapshot" : false,
"lucene_version" : "4.7"
},
"tagline" : "You Know, for Search"
}
$ curl -XGET "http://localhost:9200/?pretty"
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Communicating with Elasticsearch
• REST API
Curl
Ruby
Python
PHP
Perl
JavaScript (community supported)
• Binary Protocol
Java
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Pick your client
• Java
included in distribution
• Ruby, PHP, Perl, Python
http://www.elasticsearch.org/blog/unleash-the-clients-ruby-
python-php-perl/
• Everything Else
http://www.elasticsearch.org/guide/clients/
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Indexing a document
$ curl -XPUT "http://localhost:9200/test-data/cities/21" -d '{
"rank": 21,
"city": "Boston",
"state": "Massachusetts",
"population2010": 617594,
"land_area": 48.277,
"density": 12793,
"ansi": 619463,
"location": {
"lat": 42.332,
"lon": 71.0202
},
"abbreviation": "MA"
}'
{"ok":true,"_index":"test-data","_type":"cities","_id":"21","_version":1}
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Getting a document
{
"_index" : "test-data",
"_type" : "cities",
"_id" : "21",
"_version" : 1,
"exists" : true, "_source" : {
"rank": 21,
"city": "Boston",
"state": "Massachusetts",
"population2010": 617594,
"land_area": 48.277,
"density": 12793,
"ansi": 619463,
"location": {
"lat": 42.332,
"lon": 71.0202
},
"abbreviation": "MA"
}
}
$ curl -XGET "http://localhost:9200/test-data/cities/21?pretty"
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Updating a document
$ curl -XPUT "http://localhost:9200/test-data/cities/21" -d '{
"rank": 21,
"city": "Boston",
"state": "Massachusetts",
"population2010": 617594,
"population2012": 636479,
"land_area": 48.277,
"density": 12793,
"ansi": 619463,
"location": {
"lat": 42.332,
"lon": 71.0202
},
"abbreviation": "MA"
}'
{"ok":true,"_index":"test-data","_type":"cities","_id":"21","_version":2}
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Searching
$ curl -XGET 'http://localhost:9200/test-data/cities/_search?pretty' -d '{
"query": {
"match": {
"city": "Boston"
}
}
}'
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Searching
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 6.1357985,
"hits" : [ {
"_index" : "test-data",
"_type" : "cities",
"_id" : "21",
"_score" : 6.1357985, "_source" : {"rank":"21","city":"Boston",...}
} ]
}
}
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Range Queries
$ curl -XGET "http://localhost:9200/test-data/cities/_search?pretty" -d '{
"query": {
"range": {
"population2012": {
"from": 500000,
"to": 1000000
}
}
}
}'
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Boolean Queries
$ curl -XGET "http://localhost:9200/test-data/cities/_search?pretty" -d '{
"query": {
"bool": {
"should": [{
"match": { "state": "Texas"}
}, {
"match": { "state": "California"}
}],
"must": {
"range": {
"population2012": {
"from": 500000,
"to": 1000000
}
}
},
"minimum_should_match": 1
}
}
}'
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
MatchAll Query
$ curl -XGET "http://localhost:9200/test-data/cities/_search?pretty" -d '{
"query": {
"match_all": { }
}
}'
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Sorting and Paging
$ curl -XGET "http://localhost:9200/test-data/cities/_search?pretty" -d '{
"query": {
"match_all": { }
},
"sort": [
{"state": {"order": "asc"}},
{"population2010": {"order": "desc"}}
],
"from": 0,
"size": 20
}'
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Analysis
• By default string are
- Divided into words (tokens)
- All tokens are converted to lower-case
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Analysis Example
• “Elasticsearch is a powerful open source search
and analytics engine.”
1. elasticsearch
2. is
3. a
4. powerful
5. open
6. source
7. search
8. and
9. analytics
10. engine
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Customizing the mapping
curl -XPUT 'http://localhost:9200/my_index/' -d '{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
}
},
"mappings": {
"my_type": {
"properties": {
"description": { "type": "string" },
"sku": { "type": "string", "index": "not_analyzed" },
"count": { "type": "integer" },
"price": { "type": "float" },
"location": { "type": "geo_point" }
}
}
}
}'
exact	

match
analyzed	

text
geo	

location
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Elasticsearch Reference
• http://www.elasticsearch.org/guide/
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Ideas for hackathon
• Explore data
wikipedia
twitter
enron emails
• Play with Kibana
• Build Elasticsearch plugins
• Get prizes
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
Elasticsearch Meetup
http://www.meetup.com/Elasticsearch-Boston/
Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited
We are hiring
http://www.elasticsearch.com/about/jobs/

Contenu connexe

En vedette

Case study questions_6
Case study questions_6Case study questions_6
Case study questions_6
professorsrb
 
Lets talk about user centered design
Lets talk about user centered designLets talk about user centered design
Lets talk about user centered design
Agustín Schelstraete
 
week4-measuring data
week4-measuring dataweek4-measuring data
week4-measuring data
ispkosova
 
Camtasia getting started guide
Camtasia getting started guideCamtasia getting started guide
Camtasia getting started guide
andreseba20
 
Week3 intro to computer (history of comps, comps in everyday life)
Week3   intro to computer (history of comps, comps in everyday life)Week3   intro to computer (history of comps, comps in everyday life)
Week3 intro to computer (history of comps, comps in everyday life)
ispkosova
 
Compuestos que dañan el organismo
Compuestos que dañan el organismoCompuestos que dañan el organismo
Compuestos que dañan el organismo
Karen Urquijo
 
L5 assignment: How to integrate the modern 70 year-old into a connected society.
L5 assignment: How to integrate the modern 70 year-old into a connected society.L5 assignment: How to integrate the modern 70 year-old into a connected society.
L5 assignment: How to integrate the modern 70 year-old into a connected society.
Agustín Schelstraete
 

En vedette (20)

Case study questions_6
Case study questions_6Case study questions_6
Case study questions_6
 
Lets talk about user centered design
Lets talk about user centered designLets talk about user centered design
Lets talk about user centered design
 
week4-measuring data
week4-measuring dataweek4-measuring data
week4-measuring data
 
Higiene y seguridad industrial
Higiene y seguridad industrialHigiene y seguridad industrial
Higiene y seguridad industrial
 
Camtasia getting started guide
Camtasia getting started guideCamtasia getting started guide
Camtasia getting started guide
 
áLbum fotográfico EAD
áLbum fotográfico EADáLbum fotográfico EAD
áLbum fotográfico EAD
 
Young marketers 3 the final round + nguyễn thanh nhàn
Young marketers 3   the final round + nguyễn thanh nhànYoung marketers 3   the final round + nguyễn thanh nhàn
Young marketers 3 the final round + nguyễn thanh nhàn
 
Victimas del desplazamiento forzado
Victimas del desplazamiento forzadoVictimas del desplazamiento forzado
Victimas del desplazamiento forzado
 
European union: a quick explaination
European union: a quick explainationEuropean union: a quick explaination
European union: a quick explaination
 
Influence of Mobile Money on Transactions in Africa; Focus East Africa
Influence of Mobile Money on Transactions in Africa; Focus East AfricaInfluence of Mobile Money on Transactions in Africa; Focus East Africa
Influence of Mobile Money on Transactions in Africa; Focus East Africa
 
Week3 intro to computer (history of comps, comps in everyday life)
Week3   intro to computer (history of comps, comps in everyday life)Week3   intro to computer (history of comps, comps in everyday life)
Week3 intro to computer (history of comps, comps in everyday life)
 
Actividad 1
Actividad 1Actividad 1
Actividad 1
 
vida saludable
vida saludablevida saludable
vida saludable
 
Challenges of Monetary Policy Communication
Challenges of Monetary Policy CommunicationChallenges of Monetary Policy Communication
Challenges of Monetary Policy Communication
 
Acción comunicativa no violenta
Acción comunicativa no violenta Acción comunicativa no violenta
Acción comunicativa no violenta
 
Windows Phone 8 - What's new
Windows Phone 8 - What's newWindows Phone 8 - What's new
Windows Phone 8 - What's new
 
Compuestos que dañan el organismo
Compuestos que dañan el organismoCompuestos que dañan el organismo
Compuestos que dañan el organismo
 
Proceso de paz
Proceso de pazProceso de paz
Proceso de paz
 
Cônicas e parábolas phdnet
Cônicas e parábolas   phdnetCônicas e parábolas   phdnet
Cônicas e parábolas phdnet
 
L5 assignment: How to integrate the modern 70 year-old into a connected society.
L5 assignment: How to integrate the modern 70 year-old into a connected society.L5 assignment: How to integrate the modern 70 year-old into a connected society.
L5 assignment: How to integrate the modern 70 year-old into a connected society.
 

Similaire à Elasticsearch Quick Introduction

Real-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @MoldcampReal-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @Moldcamp
Alexei Gorobets
 

Similaire à Elasticsearch Quick Introduction (20)

ElasticSearch - Introduction to Aggregations
ElasticSearch - Introduction to AggregationsElasticSearch - Introduction to Aggregations
ElasticSearch - Introduction to Aggregations
 
Philipp Krenn | Make Your Data FABulous | Codemotion Madrid 2018
Philipp Krenn | Make Your Data FABulous | Codemotion Madrid 2018Philipp Krenn | Make Your Data FABulous | Codemotion Madrid 2018
Philipp Krenn | Make Your Data FABulous | Codemotion Madrid 2018
 
Philipp Krenn "Make Your Data FABulous"
Philipp Krenn "Make Your Data FABulous"Philipp Krenn "Make Your Data FABulous"
Philipp Krenn "Make Your Data FABulous"
 
Hypermedia APIs and HATEOAS
Hypermedia APIs and HATEOASHypermedia APIs and HATEOAS
Hypermedia APIs and HATEOAS
 
Lies you have been told about REST
Lies you have been told about RESTLies you have been told about REST
Lies you have been told about REST
 
Intro to Big Data - Orlando Code Camp 2014
Intro to Big Data - Orlando Code Camp 2014Intro to Big Data - Orlando Code Camp 2014
Intro to Big Data - Orlando Code Camp 2014
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
Real-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @MoldcampReal-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @Moldcamp
 
Understanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune QueriesUnderstanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune Queries
 
Anwendungsfaelle für Elasticsearch
Anwendungsfaelle für ElasticsearchAnwendungsfaelle für Elasticsearch
Anwendungsfaelle für Elasticsearch
 
Ams adapters
Ams adaptersAms adapters
Ams adapters
 
Starting out with MongoDB
Starting out with MongoDBStarting out with MongoDB
Starting out with MongoDB
 
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
 
Deep dive into N1QL: SQL for JSON: Internals and power features.
Deep dive into N1QL: SQL for JSON: Internals and power features.Deep dive into N1QL: SQL for JSON: Internals and power features.
Deep dive into N1QL: SQL for JSON: Internals and power features.
 
Montreal Elasticsearch Meetup
Montreal Elasticsearch MeetupMontreal Elasticsearch Meetup
Montreal Elasticsearch Meetup
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
 
Web of things introduction
Web of things introductionWeb of things introduction
Web of things introduction
 
Elasticsearch intro output
Elasticsearch intro outputElasticsearch intro output
Elasticsearch intro output
 
Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"
 
Soaring through the Clouds - Oracle Fusion Middleware Partner Forum 2016
Soaring through the Clouds - Oracle Fusion Middleware Partner Forum 2016 Soaring through the Clouds - Oracle Fusion Middleware Partner Forum 2016
Soaring through the Clouds - Oracle Fusion Middleware Partner Forum 2016
 

Dernier

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
anilsa9823
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

Elasticsearch Quick Introduction

  • 1. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Elasticsearch and MIT Sloan Data Analytics Hackathon Cambridge, MA - May 10, 2014 Elasticsearch Quick Introduction
  • 2. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited About Me • Igor Motov • Developer at Elasticsearch Inc. • Github: imotov • Twitter: @imotov
  • 3. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited About Elasticsearch Inc. • Founded in 2012 By the people behind the Elasticsearch and Apache Lucene http://www.elasticsearch.com Headquarters: Amsterdam and Los Altos, CA • We provide Training (public & onsite) Development support Production support subscription (SLA)
  • 4. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited About Elasticsearch • Real time search and analytics engine JSON-oriented, Apache Lucene-based • Automatic Schema Detection Enables control of it when needed • Distributed Scales Up+Out, Highly Available • Multi-tenancy Dynamically create/delete indices • API centric Most functionality is exposed through an API
  • 5. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Basic Concepts • Cluster a group of nodes sharing the same set of indices • Node a running Elasticsearch instance (typically JVM process) • Index a set of documents of possibly different types stored in one or more shards • Type a set of documents in an index that share the same schema • Shard a Lucene index, allocated on one of the nodes
  • 6. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Basic Concepts - Document • JSON Object ! ! ! ! ! ! • Identified by index/type/id { "rank": 21, "city": "Boston", "state": "Massachusetts", "population2010": 617594, "land_area": 48.277, "density": 12793, "ansi": 619463, "location": { "lat": 42.332, "lon": 71.0202 }, "abbreviation": "MA" }
  • 7. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Downloading elasticsearch • http://www.elasticsearch.org/download/ Windows Everything else
  • 8. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited What’s in a distribution? . ├── LICENSE.txt ├── NOTICE.txt ├── README.textile ├── bin │   ├── elasticsearch │   ├── elasticsearch.in.sh │   └── plugin ├── config │   ├── elasticsearch.yml │   └── logging.yml ├── data │   └── elasticsearch ├── lib │   ├── elasticsearch-x.y.z.jar │   ├── ... │   └── └── logs    ├── elasticsearch.log    └── elasticsearch_index_search_slowlog.log executable scripts node config files data storage libs log files
  • 9. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Configuration (multicast) • Configuration config/elasticsearch.yml cluster.name: "elasticsearch-imotov" unique name
  • 10. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Configuration (stand-alone) • Configuration config/elasticsearch.yml cluster.name: "elasticsearch-imotov" network.host: "127.0.0.1" discovery.zen.ping.multicast.enabled: false discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301", “localhost:9302"] unique name listen only on localhost disable multicast search for other nodes on localhost
  • 11. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Starting elasticsearch • Foreground ! ! • Background $ bin/elasticsearch $ bin/elasticsearch -d
  • 12. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Is it running? { "status" : 200, "name" : "Kamal", "version" : { "number" : "1.1.1", "build_hash" : "f1585f096d3f3985e73456debdc1a0745f512bbc", "build_timestamp" : "2014-04-16T14:27:12Z", "build_snapshot" : false, "lucene_version" : "4.7" }, "tagline" : "You Know, for Search" } $ curl -XGET "http://localhost:9200/?pretty"
  • 13. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Communicating with Elasticsearch • REST API Curl Ruby Python PHP Perl JavaScript (community supported) • Binary Protocol Java
  • 14. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Pick your client • Java included in distribution • Ruby, PHP, Perl, Python http://www.elasticsearch.org/blog/unleash-the-clients-ruby- python-php-perl/ • Everything Else http://www.elasticsearch.org/guide/clients/
  • 15. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Indexing a document $ curl -XPUT "http://localhost:9200/test-data/cities/21" -d '{ "rank": 21, "city": "Boston", "state": "Massachusetts", "population2010": 617594, "land_area": 48.277, "density": 12793, "ansi": 619463, "location": { "lat": 42.332, "lon": 71.0202 }, "abbreviation": "MA" }' {"ok":true,"_index":"test-data","_type":"cities","_id":"21","_version":1}
  • 16. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Getting a document { "_index" : "test-data", "_type" : "cities", "_id" : "21", "_version" : 1, "exists" : true, "_source" : { "rank": 21, "city": "Boston", "state": "Massachusetts", "population2010": 617594, "land_area": 48.277, "density": 12793, "ansi": 619463, "location": { "lat": 42.332, "lon": 71.0202 }, "abbreviation": "MA" } } $ curl -XGET "http://localhost:9200/test-data/cities/21?pretty"
  • 17. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Updating a document $ curl -XPUT "http://localhost:9200/test-data/cities/21" -d '{ "rank": 21, "city": "Boston", "state": "Massachusetts", "population2010": 617594, "population2012": 636479, "land_area": 48.277, "density": 12793, "ansi": 619463, "location": { "lat": 42.332, "lon": 71.0202 }, "abbreviation": "MA" }' {"ok":true,"_index":"test-data","_type":"cities","_id":"21","_version":2}
  • 18. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Searching $ curl -XGET 'http://localhost:9200/test-data/cities/_search?pretty' -d '{ "query": { "match": { "city": "Boston" } } }'
  • 19. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Searching { "took" : 5, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "failed" : 0 }, "hits" : { "total" : 1, "max_score" : 6.1357985, "hits" : [ { "_index" : "test-data", "_type" : "cities", "_id" : "21", "_score" : 6.1357985, "_source" : {"rank":"21","city":"Boston",...} } ] } }
  • 20. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Range Queries $ curl -XGET "http://localhost:9200/test-data/cities/_search?pretty" -d '{ "query": { "range": { "population2012": { "from": 500000, "to": 1000000 } } } }'
  • 21. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Boolean Queries $ curl -XGET "http://localhost:9200/test-data/cities/_search?pretty" -d '{ "query": { "bool": { "should": [{ "match": { "state": "Texas"} }, { "match": { "state": "California"} }], "must": { "range": { "population2012": { "from": 500000, "to": 1000000 } } }, "minimum_should_match": 1 } } }'
  • 22. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited MatchAll Query $ curl -XGET "http://localhost:9200/test-data/cities/_search?pretty" -d '{ "query": { "match_all": { } } }'
  • 23. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Sorting and Paging $ curl -XGET "http://localhost:9200/test-data/cities/_search?pretty" -d '{ "query": { "match_all": { } }, "sort": [ {"state": {"order": "asc"}}, {"population2010": {"order": "desc"}} ], "from": 0, "size": 20 }'
  • 24. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Analysis • By default string are - Divided into words (tokens) - All tokens are converted to lower-case
  • 25. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Analysis Example • “Elasticsearch is a powerful open source search and analytics engine.” 1. elasticsearch 2. is 3. a 4. powerful 5. open 6. source 7. search 8. and 9. analytics 10. engine
  • 26. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Customizing the mapping curl -XPUT 'http://localhost:9200/my_index/' -d '{ "settings": { "index": { "number_of_shards": 1, "number_of_replicas": 0 } }, "mappings": { "my_type": { "properties": { "description": { "type": "string" }, "sku": { "type": "string", "index": "not_analyzed" }, "count": { "type": "integer" }, "price": { "type": "float" }, "location": { "type": "geo_point" } } } } }' exact match analyzed text geo location
  • 27. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Elasticsearch Reference • http://www.elasticsearch.org/guide/
  • 28. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Ideas for hackathon • Explore data wikipedia twitter enron emails • Play with Kibana • Build Elasticsearch plugins • Get prizes
  • 29. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited Elasticsearch Meetup http://www.meetup.com/Elasticsearch-Boston/
  • 30. Copyright Elasticsearch 2014. Copying, publishing and/or distributing without written permission is strictly prohibited We are hiring http://www.elasticsearch.com/about/jobs/