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...
$ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘{     "book": {         "name": "PHP a XML",         "ean": 978802...
$ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘{     "book": {         "name": "PHP a XML",         "ean": 978802...
$ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘{     "book": {         "name": "PHP a XML",         "ean": 978802...
$ curl –XPUT localhost:9200/amazon/book/978802471164 –d‘{     "book": {         "name": "PHP a XML",         "ean": 978802...
$ 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    },...
   Specific searching   Multiple conditions
{    "match" : {        "book.name" : "PHP a XML"    }}WHERE name = "PHP a XML"
{    "ids" : {        "type" : "book",        "values" : [              9788024711164,              9788024727257         ...
{    "prefix" : { "producer" : "gra" }}WHERE producer LIKE "gra%"
{     "range":         "price": {              "from": 200,              "to": 300        }    }}WHERE price BETWEEN 200 A...
+ = 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...
{    "query": {        "bool": {            "should": [                {                    "ids": {                      ...
   Sometimes too easy   Many ways to hit the target   Sometimes too complicated   Sometimes unpredicted behaviour   D...
Upcoming SlideShare
Loading in...5
×

Elasticsearch

934

Published on

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
934
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
32
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Elasticsearch

  1. 1. Why so serious?
  2. 2.  Cloud friendly database Based on Apache Lucene (Java) Linux only
  3. 3.  Document oriented Schema free – why bother? REST API JSON
  4. 4. _________{ "book": { "name": "PHP a XML", "ean": 9788024711164, "producer": "Grada", "price": 249, "author": { "name": "Jiří", "lastname": "Kosek" }, "categories": [ "XML", "PHP" ] }}
  5. 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. 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. 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. 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" ] }}‘
  9. 9. $ curl –XGETlocalhost:9200/amazon/book/9788024711164
  10. 10. $ curl –XGETlocalhost:9200/amazon/book/_search?q=category:XML
  11. 11. $ curl –XGETlocalhost:9200/amazon/book/_search?q=category:XML&from=10&size=10
  12. 12. $ curl –XGETlocalhost:9200/amazon/book,page/_search?q=category:XML
  13. 13. $ curl –XGETlocalhost:9200/amazon/_search?q=category:XML
  14. 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. 15.  Specific searching Multiple conditions
  16. 16. { "match" : { "book.name" : "PHP a XML" }}WHERE name = "PHP a XML"
  17. 17. { "ids" : { "type" : "book", "values" : [ 9788024711164, 9788024727257 ] }}WHERE id IN(...)
  18. 18. { "prefix" : { "producer" : "gra" }}WHERE producer LIKE "gra%"
  19. 19. { "range": "price": { "from": 200, "to": 300 } }}WHERE price BETWEEN 200 AND 300
  20. 20. + = single character* = mulitple characters{ "wildcard" : { "book.name" :"P+P *" }}
  21. 21. { "span_first" : { "match" : { "span_term" : { "name" : "PHP" } }, "end" : 1 }}
  22. 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. 23. { "query": { "bool": { "should": [ { "ids": { "values": [ "64135" ], "boost": 1000000 } }, { "ids": { "values": [ "60558" ], "boost": 999000 } },
  24. 24.  Sometimes too easy Many ways to hit the target Sometimes too complicated Sometimes unpredicted behaviour Difficult debugging
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×