SlideShare una empresa de Scribd logo
1 de 24
Why so serious?
   Cloud friendly database
   Based on Apache Lucene (Java)
   Linux only
   Document oriented
   Schema free – why bother?
   REST API
   JSON
_________
{
    "book": {
        "name": "PHP a XML",
        "ean": 9788024711164,
        "producer": "Grada",
        "price": 249,
        "author": {
            "name": "Jiří",
            "lastname": "Kosek"
        },
        "categories": [
            "XML",
            "PHP"
        ]
    }
}
$ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘
{
     "book": {
         "name": "PHP a XML",
         "ean": 9788024711164,
         "producer": "Grada",
         "price": 249,
         "author": {
             "name": "Jiří",
             "lastname": "Kosek"
         },
         "categories": [
             "XML",
             "PHP"
         ]
     }
}‘
$ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘
{
     "book": {
         "name": "PHP a XML",
         "ean": 9788024711164,
         "producer": "Grada",
         "price": 249,
         "author": {
             "name": "Jiří",
             "lastname": "Kosek"
         },
         "categories": [
             "XML",
             "PHP"
         ]
     }
}‘
$ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘
{
     "book": {
         "name": "PHP a XML",
         "ean": 9788024711164,
         "producer": "Grada",
         "price": 249,
         "author": {
             "name": "Jiří",
             "lastname": "Kosek"
         },
         "categories": [
             "XML",
             "PHP"
         ]
     }
}‘
$ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘
{
     "book": {
         "name": "PHP a XML",
         "ean": 9788024711164,
         "producer": "Grada",
         "price": 249,
         "author": {
             "name": "Jiří",
             "lastname": "Kosek"
         },
         "categories": [
             "XML",
             "PHP"
         ]
     }
}‘
$ curl –XGET
localhost:9200/amazon/book/9788024711
164
$ curl –XGET
localhost:9200/amazon/book/_search?q=
category:XML
$ curl –XGET
localhost:9200/amazon/book/_search?q=
category:XML
&from=10&size=10
$ curl –XGET
localhost:9200/amazon/book,page/
_search?q=category:XML
$ curl –XGET
localhost:9200/amazon/_search?q=
category:XML
{
    "took": 3,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "failed": 0
    },
    "hits": {
        "total": 119,
        "max_score": 0.23119758,
        "hits": [
            {
                "_index": "levneucebnice_fulltext4",
                "_type": "products",
                "_id": "64135",
                "_score": 0.23119758,
                "_source": {
                    "id": "64135",
                    "name": "Anatomie 1 - Třetí, upravené a doplněné
vydání",
   Specific searching
   Multiple conditions
{
    "match" : {
        "book.name" : "PHP a XML"
    }
}

WHERE name = "PHP a XML"
{
    "ids" : {
        "type" : "book",
        "values" : [
              9788024711164,
              9788024727257
         ]
    }
}

WHERE id IN(...)
{
    "prefix" : { "producer" : "gra" }
}

WHERE producer LIKE "gra%"
{
     "range":
         "price": {
              "from": 200,
              "to": 300
        }
    }
}

WHERE price BETWEEN 200 AND 300
+ = single character
* = mulitple characters


{
    "wildcard" : { "book.name" :
"P+P *" }
}
{
    "span_first" : {
        "match" : {
            "span_term" : { "name" : "PHP" }
        },
        "end" : 1
    }
}
   Combining conditions
   No default order
{
     "bool" : {
         "must" : {
             "term" : { "producer" : "grada" }
         },
         "must_not" : {
             "range" : {
                 "price" : { "from" : 100, "to" : 200 }
             }
         },
         "should" : [
             {
                 "term" : { "category" : "PHP" }
             },
             {
                 "term" : { "category" : "XML" }
             }
         ]
     }
}
{
    "query": {
        "bool": {
            "should": [
                {
                    "ids": {
                        "values": [
                             "64135"
                        ],
                        "boost": 1000000
                    }
                },
                {
                    "ids": {
                        "values": [
                             "60558"
                        ],
                        "boost": 999000
                    }
                },
   Sometimes too easy

   Many ways to hit the target

   Sometimes too complicated

   Sometimes unpredicted behaviour

   Difficult debugging

Más contenido relacionado

La actualidad más candente

"Powerful Analysis with the Aggregation Pipeline (Tutorial)"
"Powerful Analysis with the Aggregation Pipeline (Tutorial)""Powerful Analysis with the Aggregation Pipeline (Tutorial)"
"Powerful Analysis with the Aggregation Pipeline (Tutorial)"
MongoDB
 
Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHP
Jeremy Kendall
 

La actualidad más candente (20)

ELK Stack - Turn boring logfiles into sexy dashboard
ELK Stack - Turn boring logfiles into sexy dashboardELK Stack - Turn boring logfiles into sexy dashboard
ELK Stack - Turn boring logfiles into sexy dashboard
 
Montreal Elasticsearch Meetup
Montreal Elasticsearch MeetupMontreal Elasticsearch Meetup
Montreal Elasticsearch Meetup
 
MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...
MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...
MongoDB .local Munich 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pip...
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev Teams
 
Building a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and JavaBuilding a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and Java
 
はじめてのMongoDB
はじめてのMongoDBはじめてのMongoDB
はじめてのMongoDB
 
Beyond the Basics 2: Aggregation Framework
Beyond the Basics 2: Aggregation Framework Beyond the Basics 2: Aggregation Framework
Beyond the Basics 2: Aggregation Framework
 
Inside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source Database
 
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
Apache CouchDB Presentation @ Sept. 2104 GTALUG MeetingApache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
 
NoSQL - An introduction to CouchDB
NoSQL - An introduction to CouchDBNoSQL - An introduction to CouchDB
NoSQL - An introduction to CouchDB
 
"Powerful Analysis with the Aggregation Pipeline (Tutorial)"
"Powerful Analysis with the Aggregation Pipeline (Tutorial)""Powerful Analysis with the Aggregation Pipeline (Tutorial)"
"Powerful Analysis with the Aggregation Pipeline (Tutorial)"
 
Real World CouchDB
Real World CouchDBReal World CouchDB
Real World CouchDB
 
MongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB Performance
 
An Introduction to JSON JavaScript Object Notation
An Introduction to JSON JavaScript Object NotationAn Introduction to JSON JavaScript Object Notation
An Introduction to JSON JavaScript Object Notation
 
Elastic search 검색
Elastic search 검색Elastic search 검색
Elastic search 검색
 
Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHP
 
Elm: delightful web development
Elm: delightful web developmentElm: delightful web development
Elm: delightful web development
 
Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHP
 
Php 102: Out with the Bad, In with the Good
Php 102: Out with the Bad, In with the GoodPhp 102: Out with the Bad, In with the Good
Php 102: Out with the Bad, In with the Good
 
Data Governance with JSON Schema
Data Governance with JSON SchemaData Governance with JSON Schema
Data Governance with JSON Schema
 

Similar a Elasticsearch

The Aggregation Framework
The Aggregation FrameworkThe Aggregation Framework
The Aggregation Framework
MongoDB
 
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
 

Similar a Elasticsearch (20)

Elasticsearch in 15 Minutes
Elasticsearch in 15 MinutesElasticsearch in 15 Minutes
Elasticsearch in 15 Minutes
 
Example-driven Web API Specification Discovery
Example-driven Web API Specification DiscoveryExample-driven Web API Specification Discovery
Example-driven Web API Specification Discovery
 
Automatic discovery of Web API Specifications: an example-driven approach
Automatic discovery of Web API Specifications: an example-driven approachAutomatic discovery of Web API Specifications: an example-driven approach
Automatic discovery of Web API Specifications: an example-driven approach
 
The Aggregation Framework
The Aggregation FrameworkThe Aggregation Framework
The Aggregation Framework
 
elasticsearch - advanced features in practice
elasticsearch - advanced features in practiceelasticsearch - advanced features in practice
elasticsearch - advanced features in practice
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用
 
AWS CloudFormation Session
AWS CloudFormation SessionAWS CloudFormation Session
AWS CloudFormation Session
 
Parallel SQL and Analytics with Solr: Presented by Yonik Seeley, Cloudera
Parallel SQL and Analytics with Solr: Presented by Yonik Seeley, ClouderaParallel SQL and Analytics with Solr: Presented by Yonik Seeley, Cloudera
Parallel SQL and Analytics with Solr: Presented by Yonik Seeley, Cloudera
 
Webinar: Strongly Typed Languages and Flexible Schemas
Webinar: Strongly Typed Languages and Flexible SchemasWebinar: Strongly Typed Languages and Flexible Schemas
Webinar: Strongly Typed Languages and Flexible Schemas
 
Liferay Search: Best Practices to Dramatically Improve Relevance - Liferay Sy...
Liferay Search: Best Practices to Dramatically Improve Relevance - Liferay Sy...Liferay Search: Best Practices to Dramatically Improve Relevance - Liferay Sy...
Liferay Search: Best Practices to Dramatically Improve Relevance - Liferay Sy...
 
Webinar: Data Processing and Aggregation Options
Webinar: Data Processing and Aggregation OptionsWebinar: Data Processing and Aggregation Options
Webinar: Data Processing and Aggregation Options
 
Aggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days MunichAggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days Munich
 
d3sparql.js demo at SWAT4LS 2014 in Berlin
d3sparql.js demo at SWAT4LS 2014 in Berlind3sparql.js demo at SWAT4LS 2014 in Berlin
d3sparql.js demo at SWAT4LS 2014 in Berlin
 
Strongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible SchemasStrongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible Schemas
 
ElasticSearch at berlinbuzzwords 2010
ElasticSearch at berlinbuzzwords 2010ElasticSearch at berlinbuzzwords 2010
ElasticSearch at berlinbuzzwords 2010
 
Ams adapters
Ams adaptersAms adapters
Ams adapters
 
Introduction to GraphQL at API days
Introduction to GraphQL at API daysIntroduction to GraphQL at API days
Introduction to GraphQL at API days
 
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
 
Agile Testing Days 2018 - API Fundamentals - postman collection
Agile Testing Days 2018 - API Fundamentals - postman collectionAgile Testing Days 2018 - API Fundamentals - postman collection
Agile Testing Days 2018 - API Fundamentals - postman collection
 
SDKs, the good the bad the ugly - Japan
SDKs, the good the bad the ugly - JapanSDKs, the good the bad the ugly - Japan
SDKs, the good the bad the ugly - Japan
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Elasticsearch

  • 2. Cloud friendly database  Based on Apache Lucene (Java)  Linux only
  • 3. Document oriented  Schema free – why bother?  REST API  JSON
  • 4. _________ { "book": { "name": "PHP a XML", "ean": 9788024711164, "producer": "Grada", "price": 249, "author": { "name": "Jiří", "lastname": "Kosek" }, "categories": [ "XML", "PHP" ] } }
  • 5. $ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘ { "book": { "name": "PHP a XML", "ean": 9788024711164, "producer": "Grada", "price": 249, "author": { "name": "Jiří", "lastname": "Kosek" }, "categories": [ "XML", "PHP" ] } }‘
  • 6. $ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘ { "book": { "name": "PHP a XML", "ean": 9788024711164, "producer": "Grada", "price": 249, "author": { "name": "Jiří", "lastname": "Kosek" }, "categories": [ "XML", "PHP" ] } }‘
  • 7. $ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘ { "book": { "name": "PHP a XML", "ean": 9788024711164, "producer": "Grada", "price": 249, "author": { "name": "Jiří", "lastname": "Kosek" }, "categories": [ "XML", "PHP" ] } }‘
  • 8. $ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘ { "book": { "name": "PHP a XML", "ean": 9788024711164, "producer": "Grada", "price": 249, "author": { "name": "Jiří", "lastname": "Kosek" }, "categories": [ "XML", "PHP" ] } }‘
  • 14. { "took": 3, "timed_out": false, "_shards": { "total": 1, "successful": 1, "failed": 0 }, "hits": { "total": 119, "max_score": 0.23119758, "hits": [ { "_index": "levneucebnice_fulltext4", "_type": "products", "_id": "64135", "_score": 0.23119758, "_source": { "id": "64135", "name": "Anatomie 1 - Třetí, upravené a doplněné vydání",
  • 15. Specific searching  Multiple conditions
  • 16. { "match" : { "book.name" : "PHP a XML" } } WHERE name = "PHP a XML"
  • 17. { "ids" : { "type" : "book", "values" : [ 9788024711164, 9788024727257 ] } } WHERE id IN(...)
  • 18. { "prefix" : { "producer" : "gra" } } WHERE producer LIKE "gra%"
  • 19. { "range": "price": { "from": 200, "to": 300 } } } WHERE price BETWEEN 200 AND 300
  • 20. + = single character * = mulitple characters { "wildcard" : { "book.name" : "P+P *" } }
  • 21. { "span_first" : { "match" : { "span_term" : { "name" : "PHP" } }, "end" : 1 } }
  • 22. Combining conditions  No default order { "bool" : { "must" : { "term" : { "producer" : "grada" } }, "must_not" : { "range" : { "price" : { "from" : 100, "to" : 200 } } }, "should" : [ { "term" : { "category" : "PHP" } }, { "term" : { "category" : "XML" } } ] } }
  • 23. { "query": { "bool": { "should": [ { "ids": { "values": [ "64135" ], "boost": 1000000 } }, { "ids": { "values": [ "60558" ], "boost": 999000 } },
  • 24. Sometimes too easy  Many ways to hit the target  Sometimes too complicated  Sometimes unpredicted behaviour  Difficult debugging