Elasticsearch
Upcoming SlideShare
Loading in...5
×
 

Elasticsearch

on

  • 1,151 views

 

Statistics

Views

Total Views
1,151
Views on SlideShare
1,151
Embed Views
0

Actions

Likes
3
Downloads
30
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Elasticsearch Elasticsearch Presentation Transcript

  • 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 –XGETlocalhost:9200/amazon/book/9788024711164
  • $ curl –XGETlocalhost:9200/amazon/book/_search?q=category:XML
  • $ curl –XGETlocalhost:9200/amazon/book/_search?q=category:XML&from=10&size=10
  • $ curl –XGETlocalhost:9200/amazon/book,page/_search?q=category:XML
  • $ curl –XGETlocalhost: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