SlideShare a Scribd company logo
Elasticsearch Reference
Indices APIs
Postman Shared Collection
http://goo.gl/Px9jf2
Indices
Create Indices
$ curl -XPUT localhost:9200/twitter/
$ curl -XPUT localhost:9200/twitter/ -d '
index :
number_of_shards : 3
number_of_replicas : 2
'
More about Index Settings => Index Modules
$ curl -XPUT localhost:9200/twitter/ -d '
{
"settings" : {
"index" : {
"number_of_shards" : 3,
"number_of_replicas" : 2
}
}
}
'
or, simply
$ curl -XPUT localhost:9200/twitter/ -d '
{
"settings" : {
"number_of_shards" : 3,
"number_of_replicas" : 2
}
}
'
Delete Indices
$ curl -XDELETE localhost:9200/twitter/
Indices Exist?
$ curl -XHEAD localhost:9200/twitter
Open/Close Indices
$ curl -XPOST localhost:9200/twitter/_close
$ curl -XPOST localhost:9200/twitter/_open
Update Index Settings
$ curl -XPUT localhost:9200/twitter/_settings -d '
{
"index" : {
"number_of_replicas" : 4
}
}
'
Get Index Settings
$ curl -XGET localhost:9200/twitter/_settings
Supports multiple indices.
$ curl -XGET localhost:9200/twitter,kimchy/_settings
$ curl -XGET localhost:9200/_all/_settings
$ curl -XGET localhost:9200/2013-*/_settings
Filter settings with prefix and name options.
$ curl -XGET localhost:9200/twitter/_settings?prefix=index.
$ curl -XGET localhost:9200/_all/_settings?prefix=index.routing.allocation.
$ curl -XGET localhost:9200/2013-*/_settings?name=index.merge.*
$ curl -XGET localhost:9200/2013-*/_settings/index.merge.*
Mappings
Put Mappings
$ curl -XPUT localhost:9200/twitter/tweet/_mapping -d '
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : true }
}
}
}
'
More about Mappings => Mapping
Supports multi indices.
$ curl -XPUT localhost:9200/twitter,facebook/tweet/_mapping -d '
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : true }
}
}
}
'
Get Mappings
$ curl -XGET localhost:9200/twitter/tweet/_mapping
Also, supports multi indices and types.
$ curl -XGET localhost:9200/twitter,facebook/_mapping
$ curl -XGET localhost:9200/_all/tweet,post/_mapping
Get Field Mappings
$ curl -XGET localhost:9200/twitter/tweet/_mapping/field/text
Of course, also supports multi indices, types and fields.
$ curl -XGET localhost:9200/twitter,facebook/_mapping/field/message
$ curl -XGET localhost:9200/_all/tweet,post/_mapping/field/message,user.id
$ curl -XGET localhost:9200/_all/tw*/_mapping/field/*.id
Types Exist?
$ curl -XHEAD localhost:9200/twitter/tweet
Delete Mappings
$ curl -XDELETE localhost:9200/twitter/tweet/_mapping
$ curl -XDELETE localhost:9200/twitter/tweet
Deleting Mapping == Deleting Types
Aliases
Index Aliases
Alias == View (in RDB)
Add Aliases
$ curl -XPOST localhost:9200/_aliases -d '
{
"actions" : [
{ "add" : { "index" : "twitter", "alias" : "alias1" } }
]
}
'
Get Aliases
$ curl -XGET localhost:9200/_aliases
Remove Aliases
$ curl -XPOST localhost:9200/_aliases -d '
{
"actions" : [
{ "remove" : { "index" : "twitter", "alias" : "alias1" } }
]
}
'
Multi Actions
$ curl -XPOST localhost:9200/_aliases -d '
{
"actions" : [
{ "remove" : { "index" : "twitter", "alias" : "alias1" } },
{ "add" : { "index" : "twitter", "alias" : "alias2" } }
]
}
'
$ curl -XPOST localhost:9200/_aliases -d '
{
"actions" : [
{ "add" : { "index" : "twitter", "alias" : "alias1" } },
{ "add" : { "index" : "facebook", "alias" : "alias1" } }
]
}
'
Filtered Aliases
$ curl -XPOST localhost:9200/_aliases -d '
{
"actions" : [
{
"add" : {
"index" : "twitter",
"alias" : "alias2",
"filter" : { "term" : { "user" : "kimchy" } }
}
}
]
}
'
More about Filters => Query DSL
Routing
Filter by routing values
$ curl -XPOST localhost:9200/_aliases -d '
{
"actions" : [
{
"add" : {
"index" : "twitter",
"alias" : "alias1",
"routing" : "1"
}
}
]
}
'
Different routing values for searching and
indexing.
$ curl -XPOST localhost:9200/_aliases -d '
{
"actions" : [
{
"add" : {
"index" : "twitter",
"alias" : "alias2",
"search_routing" : "1,2",
"index_routing" : "2"
}
}
]
}
'
Analyze
Analyze
Performs the analysis process on a text and return the
tokens breakdown of the text.
$ curl -XPOST localhost:9200/_analyze?analyzer=standard -d 'this is a test'
$ curl -XPOST 'localhost:9200/_analyze?tokenizer=keyword&filters=lowercase' 
-d 'this is a test'
$ curl -XPOST 'localhost:9200/_analyze?tokenizer=keyword&token_filters=lowercase
&char_filters=html_strip' -d 'this is a <b>test</b>'
$ curl -XGET localhost:9200/twitter/_analyze?text=this+is+a+test
Templates
Index Templates
Index templates allow to define templates that will
automatically be applied to new indices created.
Create Templates
$ curl -XPUT localhost:9200/_template/template_1 -d '
{
"template" : "te*",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : false }
}
}
}
'
Will be applied to the indices with te* name pattern.
{index} placeholder
$ curl -XPUT localhost:9200/_template/template_1 -d '
{
"template" : "te*",
"settings" : {
"number_of_shards" : 1
},
"aliases" : {
"alias1" : {},
"alias2" : {
"filter" : {
"term" : {"user" : "kimchy" }
},
"routing" : "kimchy"
},
"{index}-alias" : {}
}
}
'
Delete Templates
$ curl -XDELETE localhost:9200/_template/template_1
Get Templates
$ curl -XGET localhost:9200/_template/template_1
$ curl -XGET localhost:9200/_template/temp*
$ curl -XGET localhost:9200/_template/template_1,template_2
$ curl -XGET localhost:9200/_template/
Multiple Template Matching by order
$ curl -XPUT localhost:9200/_template/template_1 -d '
{
"template" : "*",
"order" : 0,
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : false }
}
}
}
'
$ curl -XPUT localhost:9200/_template/template_2 -d '
{
"template" : "te*",
"order" : 1,
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : true }
}
}
}
'
Config
Index templates can also be placed
within config/templates directory.
Warmers
Warmers
Index warming allows to run registered search
requests to warm up the index before it is available for
search.
Warmup searches typically include requests that require
heavy loading of data, such as faceting or sorting on
specific fields.
Index Creation with Warmers
$ curl -XPUT localhost:9200/test -d '
{
"warmers" : {
"warmer_1" : {
"types" : [],
"source" : {
"query" : {
"match_all" : {}
},
"facets" : {
"facet_1" : {
"terms" : {
"field" : "field"
}
}
}
}
}
}
}
'
Put Warmers
$ curl -XPUT localhost:9200/test/_warmer/warmer_1 -d '
{
"query" : {
"match_all" : {}
},
"facets" : {
"facet_1" : {
"terms" : {
"field" : "field"
}
}
}
}
'
Delete Warmers
$ curl -XDELETE localhost:9200/test/_warmer/warmer_1
Get Warmers
$ curl -XGET localhost:9200/test/_warmer/warmer_1
$ curl -XGET localhost:9200/test/_warmer/warm*
$ curl -XGET localhost:9200/test/_warmer/
More GETs
Status
The indices status API allows to get a comprehensive
status information of one or more indices.
$ curl -XGET localhost:9200/twitter/_status
$ curl -XGET localhost:9200/twitter,kimchy/_status
$ curl -XGET localhost:9200/_status
Stats
Indices level stats provide statistics on different
operations happening on an index.
$ curl -XGET localhost:9200/twitter/_stats
$ curl -XGET localhost:9200/twitter,kimchy/_stats
$ curl -XGET localhost:9200/_stats
Segments
Provides low level segments information that a
Lucene index (shard level) is built with.
$ curl -XGET localhost:9200/twitter/_segments
$ curl -XGET localhost:9200/twitter,kimchy/_segments
$ curl -XGET localhost:9200/_segments
Recovery
The indices recovery API provides insight into on-
going shard recoveries. Recovery status may be
reported for specific indices, or cluster-wide.
$ curl -XGET localhost:9200/twitter/_recovery
$ curl -XGET localhost:9200/twitter,kimchy/_recovery
$ curl -XGET localhost:9200/_recovery
$ curl -XGET localhost:9200/twitter/_recovery?detailed=true
More POSTs
Clear Cache
The clear cache API allows to clear either all caches or
specific caches associated with one ore more indices.
$ curl -XPOST localhost:9200/twitter/_cache/clear
$ curl -XPOST localhost:9200/twitter,kimchy/_cache/clear
$ curl -XPOST localhost:9200/_cache/clear
Cache Types
— filter
— field_data
— id_cache
$ curl -XPOST localhost:9200/twitter/_cache/clear?filter=true
cf. The filter cache will be cleared within 60 seconds.
Flush
The flush process of an index basically frees memory
from the index by flushing data to the index storage and
clearing the internal transaction log.
$ curl -XPOST localhost:9200/twitter/_flush
$ curl -XPOST localhost:9200/twitter,kimchy/_flush
$ curl -XPOST localhost:9200/_flush
Refresh
The refresh API allows to explicitly refresh one or more
index, making all operations performed since the last
refresh available for search.
$ curl -XPOST localhost:9200/twitter/_refresh
$ curl -XPOST localhost:9200/twitter,kimchy/_refresh
$ curl -XPOST localhost:9200/_refresh
Optimize
The optimize process basically optimizes the index for
faster search operations.
The optimize operation allows to reduce the number of
segments by merging them.
$ curl -XPOST localhost:9200/twitter/_optimize
$ curl -XPOST localhost:9200/twitter,kimchy/_optimize
$ curl -XPOST localhost:9200/_optimize
Thank You!
by Daniel Ku (http://kjunine.net)

More Related Content

What's hot

Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design Patterns
Hugo Hamon
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
Nate Abele
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & REST
Hugo Hamon
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
Chris Wilcoxson
 
Nouveau document texte
Nouveau document texteNouveau document texte
Nouveau document texteSai Ef
 
Yy
YyYy
Yyyygh
 
Teaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersTeaching Your Machine To Find Fraudsters
Teaching Your Machine To Find Fraudsters
Ian Barber
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
Ian Barber
 
2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator
Alberto Paro
 
Method::Signatures
Method::SignaturesMethod::Signatures
Method::Signatures
Michael Schwern
 
Crazy things done on PHP
Crazy things done on PHPCrazy things done on PHP
Crazy things done on PHPTaras Kalapun
 
Introduction to CloudForecast / YAPC::Asia 2010 Tokyo
Introduction to CloudForecast / YAPC::Asia 2010 TokyoIntroduction to CloudForecast / YAPC::Asia 2010 Tokyo
Introduction to CloudForecast / YAPC::Asia 2010 TokyoMasahiro Nagano
 
Corinna Status 2022.pptx
Corinna Status 2022.pptxCorinna Status 2022.pptx
Corinna Status 2022.pptx
Curtis Poe
 
Models and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and HobgoblinsModels and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and Hobgoblins
Ross Tuck
 
ElasticSearch 5.x - New Tricks - 2017-02-08 - Elasticsearch Meetup
ElasticSearch 5.x -  New Tricks - 2017-02-08 - Elasticsearch Meetup ElasticSearch 5.x -  New Tricks - 2017-02-08 - Elasticsearch Meetup
ElasticSearch 5.x - New Tricks - 2017-02-08 - Elasticsearch Meetup
Alberto Paro
 
PHP Tips & Tricks
PHP Tips & TricksPHP Tips & Tricks
PHP Tips & Tricks
Radek Benkel
 
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingIntroduction to CQRS and Event Sourcing
Introduction to CQRS and Event Sourcing
Samuel ROZE
 
TLS305 Using DynamoDB with the AWS SDK for PHP - AWS re: Invent 2012
TLS305 Using DynamoDB with the AWS SDK for PHP - AWS re: Invent 2012TLS305 Using DynamoDB with the AWS SDK for PHP - AWS re: Invent 2012
TLS305 Using DynamoDB with the AWS SDK for PHP - AWS re: Invent 2012
Amazon Web Services
 
Xlab #1: Advantages of functional programming in Java 8
Xlab #1: Advantages of functional programming in Java 8Xlab #1: Advantages of functional programming in Java 8
Xlab #1: Advantages of functional programming in Java 8
XSolve
 

What's hot (20)

Database Design Patterns
Database Design PatternsDatabase Design Patterns
Database Design Patterns
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & REST
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
 
dotCloud and go
dotCloud and godotCloud and go
dotCloud and go
 
Nouveau document texte
Nouveau document texteNouveau document texte
Nouveau document texte
 
Yy
YyYy
Yy
 
Teaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersTeaching Your Machine To Find Fraudsters
Teaching Your Machine To Find Fraudsters
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
 
2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator
 
Method::Signatures
Method::SignaturesMethod::Signatures
Method::Signatures
 
Crazy things done on PHP
Crazy things done on PHPCrazy things done on PHP
Crazy things done on PHP
 
Introduction to CloudForecast / YAPC::Asia 2010 Tokyo
Introduction to CloudForecast / YAPC::Asia 2010 TokyoIntroduction to CloudForecast / YAPC::Asia 2010 Tokyo
Introduction to CloudForecast / YAPC::Asia 2010 Tokyo
 
Corinna Status 2022.pptx
Corinna Status 2022.pptxCorinna Status 2022.pptx
Corinna Status 2022.pptx
 
Models and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and HobgoblinsModels and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and Hobgoblins
 
ElasticSearch 5.x - New Tricks - 2017-02-08 - Elasticsearch Meetup
ElasticSearch 5.x -  New Tricks - 2017-02-08 - Elasticsearch Meetup ElasticSearch 5.x -  New Tricks - 2017-02-08 - Elasticsearch Meetup
ElasticSearch 5.x - New Tricks - 2017-02-08 - Elasticsearch Meetup
 
PHP Tips & Tricks
PHP Tips & TricksPHP Tips & Tricks
PHP Tips & Tricks
 
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingIntroduction to CQRS and Event Sourcing
Introduction to CQRS and Event Sourcing
 
TLS305 Using DynamoDB with the AWS SDK for PHP - AWS re: Invent 2012
TLS305 Using DynamoDB with the AWS SDK for PHP - AWS re: Invent 2012TLS305 Using DynamoDB with the AWS SDK for PHP - AWS re: Invent 2012
TLS305 Using DynamoDB with the AWS SDK for PHP - AWS re: Invent 2012
 
Xlab #1: Advantages of functional programming in Java 8
Xlab #1: Advantages of functional programming in Java 8Xlab #1: Advantages of functional programming in Java 8
Xlab #1: Advantages of functional programming in Java 8
 

Viewers also liked

Deploying an application with Chef and Docker
Deploying an application with Chef and DockerDeploying an application with Chef and Docker
Deploying an application with Chef and Docker
Daniel Ku
 
Google Analytics
Google AnalyticsGoogle Analytics
Google Analytics
Daniel Ku
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on Docker
Daniel Ku
 
Getting Started with Redis
Getting Started with RedisGetting Started with Redis
Getting Started with Redis
Daniel Ku
 
Object-oriented Javascript
Object-oriented JavascriptObject-oriented Javascript
Object-oriented Javascript
Daniel Ku
 
Utilizing Bluebird Promises
Utilizing Bluebird PromisesUtilizing Bluebird Promises
Utilizing Bluebird Promises
Nicholas van de Walle
 
Drupal and Elasticsearch
Drupal and ElasticsearchDrupal and Elasticsearch
Drupal and Elasticsearch
Nikolay Ignatov
 
Promise and Bluebird
Promise and BluebirdPromise and Bluebird
Promise and Bluebird
Daniel Ku
 

Viewers also liked (8)

Deploying an application with Chef and Docker
Deploying an application with Chef and DockerDeploying an application with Chef and Docker
Deploying an application with Chef and Docker
 
Google Analytics
Google AnalyticsGoogle Analytics
Google Analytics
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on Docker
 
Getting Started with Redis
Getting Started with RedisGetting Started with Redis
Getting Started with Redis
 
Object-oriented Javascript
Object-oriented JavascriptObject-oriented Javascript
Object-oriented Javascript
 
Utilizing Bluebird Promises
Utilizing Bluebird PromisesUtilizing Bluebird Promises
Utilizing Bluebird Promises
 
Drupal and Elasticsearch
Drupal and ElasticsearchDrupal and Elasticsearch
Drupal and Elasticsearch
 
Promise and Bluebird
Promise and BluebirdPromise and Bluebird
Promise and Bluebird
 

Similar to Indices APIs - Elasticsearch Reference

Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
Marcus Ramberg
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
Jonathan Wage
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
Lindsay Holmwood
 
Twig Brief, Tips&Tricks
Twig Brief, Tips&TricksTwig Brief, Tips&Tricks
Twig Brief, Tips&Tricks
Andrei Burian
 
Elasticsearch in 15 Minutes
Elasticsearch in 15 MinutesElasticsearch in 15 Minutes
Elasticsearch in 15 Minutes
Karel Minarik
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
Prajal Kulkarni
 
Ruby gems
Ruby gemsRuby gems
Ruby gems
Papp Laszlo
 
Broadleaf Presents Thymeleaf
Broadleaf Presents ThymeleafBroadleaf Presents Thymeleaf
Broadleaf Presents Thymeleaf
Broadleaf Commerce
 
I Phone On Rails
I Phone On RailsI Phone On Rails
I Phone On Rails
John Wilker
 
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 @MoldcampAlexei Gorobets
 
AWS Study Group - Chapter 03 - Elasticity and Scalability Concepts [Solution ...
AWS Study Group - Chapter 03 - Elasticity and Scalability Concepts [Solution ...AWS Study Group - Chapter 03 - Elasticity and Scalability Concepts [Solution ...
AWS Study Group - Chapter 03 - Elasticity and Scalability Concepts [Solution ...
QCloudMentor
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
Kris Wallsmith
 
Craig Brown speaks on ElasticSearch
Craig Brown speaks on ElasticSearchCraig Brown speaks on ElasticSearch
Craig Brown speaks on ElasticSearchimarcticblue
 
Curscatalyst
CurscatalystCurscatalyst
CurscatalystKar Juan
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
Scaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with ScalaScaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with Scala
Ostap Andrusiv
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overviewYehuda Katz
 
REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and Python
PiXeL16
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the FinishYehuda Katz
 
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Amazon Web Services
 

Similar to Indices APIs - Elasticsearch Reference (20)

Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Twig Brief, Tips&Tricks
Twig Brief, Tips&TricksTwig Brief, Tips&Tricks
Twig Brief, Tips&Tricks
 
Elasticsearch in 15 Minutes
Elasticsearch in 15 MinutesElasticsearch in 15 Minutes
Elasticsearch in 15 Minutes
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
 
Ruby gems
Ruby gemsRuby gems
Ruby gems
 
Broadleaf Presents Thymeleaf
Broadleaf Presents ThymeleafBroadleaf Presents Thymeleaf
Broadleaf Presents Thymeleaf
 
I Phone On Rails
I Phone On RailsI Phone On Rails
I Phone On Rails
 
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
 
AWS Study Group - Chapter 03 - Elasticity and Scalability Concepts [Solution ...
AWS Study Group - Chapter 03 - Elasticity and Scalability Concepts [Solution ...AWS Study Group - Chapter 03 - Elasticity and Scalability Concepts [Solution ...
AWS Study Group - Chapter 03 - Elasticity and Scalability Concepts [Solution ...
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
Craig Brown speaks on ElasticSearch
Craig Brown speaks on ElasticSearchCraig Brown speaks on ElasticSearch
Craig Brown speaks on ElasticSearch
 
Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Scaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with ScalaScaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with Scala
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
 
REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and Python
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
 
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
 

Recently uploaded

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 

Indices APIs - Elasticsearch Reference

  • 4. Create Indices $ curl -XPUT localhost:9200/twitter/ $ curl -XPUT localhost:9200/twitter/ -d ' index : number_of_shards : 3 number_of_replicas : 2 ' More about Index Settings => Index Modules
  • 5. $ curl -XPUT localhost:9200/twitter/ -d ' { "settings" : { "index" : { "number_of_shards" : 3, "number_of_replicas" : 2 } } } ' or, simply $ curl -XPUT localhost:9200/twitter/ -d ' { "settings" : { "number_of_shards" : 3, "number_of_replicas" : 2 } } '
  • 6. Delete Indices $ curl -XDELETE localhost:9200/twitter/
  • 7. Indices Exist? $ curl -XHEAD localhost:9200/twitter
  • 8. Open/Close Indices $ curl -XPOST localhost:9200/twitter/_close $ curl -XPOST localhost:9200/twitter/_open
  • 9. Update Index Settings $ curl -XPUT localhost:9200/twitter/_settings -d ' { "index" : { "number_of_replicas" : 4 } } '
  • 10. Get Index Settings $ curl -XGET localhost:9200/twitter/_settings Supports multiple indices. $ curl -XGET localhost:9200/twitter,kimchy/_settings $ curl -XGET localhost:9200/_all/_settings $ curl -XGET localhost:9200/2013-*/_settings
  • 11. Filter settings with prefix and name options. $ curl -XGET localhost:9200/twitter/_settings?prefix=index. $ curl -XGET localhost:9200/_all/_settings?prefix=index.routing.allocation. $ curl -XGET localhost:9200/2013-*/_settings?name=index.merge.* $ curl -XGET localhost:9200/2013-*/_settings/index.merge.*
  • 13. Put Mappings $ curl -XPUT localhost:9200/twitter/tweet/_mapping -d ' { "tweet" : { "properties" : { "message" : {"type" : "string", "store" : true } } } } ' More about Mappings => Mapping
  • 14. Supports multi indices. $ curl -XPUT localhost:9200/twitter,facebook/tweet/_mapping -d ' { "tweet" : { "properties" : { "message" : {"type" : "string", "store" : true } } } } '
  • 15. Get Mappings $ curl -XGET localhost:9200/twitter/tweet/_mapping Also, supports multi indices and types. $ curl -XGET localhost:9200/twitter,facebook/_mapping $ curl -XGET localhost:9200/_all/tweet,post/_mapping
  • 16. Get Field Mappings $ curl -XGET localhost:9200/twitter/tweet/_mapping/field/text Of course, also supports multi indices, types and fields. $ curl -XGET localhost:9200/twitter,facebook/_mapping/field/message $ curl -XGET localhost:9200/_all/tweet,post/_mapping/field/message,user.id $ curl -XGET localhost:9200/_all/tw*/_mapping/field/*.id
  • 17. Types Exist? $ curl -XHEAD localhost:9200/twitter/tweet
  • 18. Delete Mappings $ curl -XDELETE localhost:9200/twitter/tweet/_mapping $ curl -XDELETE localhost:9200/twitter/tweet Deleting Mapping == Deleting Types
  • 20. Index Aliases Alias == View (in RDB) Add Aliases $ curl -XPOST localhost:9200/_aliases -d ' { "actions" : [ { "add" : { "index" : "twitter", "alias" : "alias1" } } ] } '
  • 21. Get Aliases $ curl -XGET localhost:9200/_aliases Remove Aliases $ curl -XPOST localhost:9200/_aliases -d ' { "actions" : [ { "remove" : { "index" : "twitter", "alias" : "alias1" } } ] } '
  • 22. Multi Actions $ curl -XPOST localhost:9200/_aliases -d ' { "actions" : [ { "remove" : { "index" : "twitter", "alias" : "alias1" } }, { "add" : { "index" : "twitter", "alias" : "alias2" } } ] } ' $ curl -XPOST localhost:9200/_aliases -d ' { "actions" : [ { "add" : { "index" : "twitter", "alias" : "alias1" } }, { "add" : { "index" : "facebook", "alias" : "alias1" } } ] } '
  • 23. Filtered Aliases $ curl -XPOST localhost:9200/_aliases -d ' { "actions" : [ { "add" : { "index" : "twitter", "alias" : "alias2", "filter" : { "term" : { "user" : "kimchy" } } } } ] } ' More about Filters => Query DSL
  • 24. Routing Filter by routing values $ curl -XPOST localhost:9200/_aliases -d ' { "actions" : [ { "add" : { "index" : "twitter", "alias" : "alias1", "routing" : "1" } } ] } '
  • 25. Different routing values for searching and indexing. $ curl -XPOST localhost:9200/_aliases -d ' { "actions" : [ { "add" : { "index" : "twitter", "alias" : "alias2", "search_routing" : "1,2", "index_routing" : "2" } } ] } '
  • 27. Analyze Performs the analysis process on a text and return the tokens breakdown of the text. $ curl -XPOST localhost:9200/_analyze?analyzer=standard -d 'this is a test' $ curl -XPOST 'localhost:9200/_analyze?tokenizer=keyword&filters=lowercase' -d 'this is a test' $ curl -XPOST 'localhost:9200/_analyze?tokenizer=keyword&token_filters=lowercase &char_filters=html_strip' -d 'this is a <b>test</b>' $ curl -XGET localhost:9200/twitter/_analyze?text=this+is+a+test
  • 29. Index Templates Index templates allow to define templates that will automatically be applied to new indices created.
  • 30. Create Templates $ curl -XPUT localhost:9200/_template/template_1 -d ' { "template" : "te*", "settings" : { "number_of_shards" : 1 }, "mappings" : { "type1" : { "_source" : { "enabled" : false } } } } ' Will be applied to the indices with te* name pattern.
  • 31. {index} placeholder $ curl -XPUT localhost:9200/_template/template_1 -d ' { "template" : "te*", "settings" : { "number_of_shards" : 1 }, "aliases" : { "alias1" : {}, "alias2" : { "filter" : { "term" : {"user" : "kimchy" } }, "routing" : "kimchy" }, "{index}-alias" : {} } } '
  • 32. Delete Templates $ curl -XDELETE localhost:9200/_template/template_1 Get Templates $ curl -XGET localhost:9200/_template/template_1 $ curl -XGET localhost:9200/_template/temp* $ curl -XGET localhost:9200/_template/template_1,template_2 $ curl -XGET localhost:9200/_template/
  • 33. Multiple Template Matching by order $ curl -XPUT localhost:9200/_template/template_1 -d ' { "template" : "*", "order" : 0, "settings" : { "number_of_shards" : 1 }, "mappings" : { "type1" : { "_source" : { "enabled" : false } } } } ' $ curl -XPUT localhost:9200/_template/template_2 -d ' { "template" : "te*", "order" : 1, "settings" : { "number_of_shards" : 1 }, "mappings" : { "type1" : { "_source" : { "enabled" : true } } } } '
  • 34. Config Index templates can also be placed within config/templates directory.
  • 36. Warmers Index warming allows to run registered search requests to warm up the index before it is available for search. Warmup searches typically include requests that require heavy loading of data, such as faceting or sorting on specific fields.
  • 37. Index Creation with Warmers $ curl -XPUT localhost:9200/test -d ' { "warmers" : { "warmer_1" : { "types" : [], "source" : { "query" : { "match_all" : {} }, "facets" : { "facet_1" : { "terms" : { "field" : "field" } } } } } } } '
  • 38. Put Warmers $ curl -XPUT localhost:9200/test/_warmer/warmer_1 -d ' { "query" : { "match_all" : {} }, "facets" : { "facet_1" : { "terms" : { "field" : "field" } } } } '
  • 39. Delete Warmers $ curl -XDELETE localhost:9200/test/_warmer/warmer_1 Get Warmers $ curl -XGET localhost:9200/test/_warmer/warmer_1 $ curl -XGET localhost:9200/test/_warmer/warm* $ curl -XGET localhost:9200/test/_warmer/
  • 41. Status The indices status API allows to get a comprehensive status information of one or more indices. $ curl -XGET localhost:9200/twitter/_status $ curl -XGET localhost:9200/twitter,kimchy/_status $ curl -XGET localhost:9200/_status
  • 42. Stats Indices level stats provide statistics on different operations happening on an index. $ curl -XGET localhost:9200/twitter/_stats $ curl -XGET localhost:9200/twitter,kimchy/_stats $ curl -XGET localhost:9200/_stats
  • 43. Segments Provides low level segments information that a Lucene index (shard level) is built with. $ curl -XGET localhost:9200/twitter/_segments $ curl -XGET localhost:9200/twitter,kimchy/_segments $ curl -XGET localhost:9200/_segments
  • 44. Recovery The indices recovery API provides insight into on- going shard recoveries. Recovery status may be reported for specific indices, or cluster-wide. $ curl -XGET localhost:9200/twitter/_recovery $ curl -XGET localhost:9200/twitter,kimchy/_recovery $ curl -XGET localhost:9200/_recovery $ curl -XGET localhost:9200/twitter/_recovery?detailed=true
  • 46. Clear Cache The clear cache API allows to clear either all caches or specific caches associated with one ore more indices. $ curl -XPOST localhost:9200/twitter/_cache/clear $ curl -XPOST localhost:9200/twitter,kimchy/_cache/clear $ curl -XPOST localhost:9200/_cache/clear
  • 47. Cache Types — filter — field_data — id_cache $ curl -XPOST localhost:9200/twitter/_cache/clear?filter=true cf. The filter cache will be cleared within 60 seconds.
  • 48. Flush The flush process of an index basically frees memory from the index by flushing data to the index storage and clearing the internal transaction log. $ curl -XPOST localhost:9200/twitter/_flush $ curl -XPOST localhost:9200/twitter,kimchy/_flush $ curl -XPOST localhost:9200/_flush
  • 49. Refresh The refresh API allows to explicitly refresh one or more index, making all operations performed since the last refresh available for search. $ curl -XPOST localhost:9200/twitter/_refresh $ curl -XPOST localhost:9200/twitter,kimchy/_refresh $ curl -XPOST localhost:9200/_refresh
  • 50. Optimize The optimize process basically optimizes the index for faster search operations. The optimize operation allows to reduce the number of segments by merging them. $ curl -XPOST localhost:9200/twitter/_optimize $ curl -XPOST localhost:9200/twitter,kimchy/_optimize $ curl -XPOST localhost:9200/_optimize
  • 51. Thank You! by Daniel Ku (http://kjunine.net)