Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Elasticsearch VilniusPHP

Simon
September 05, 2013

Elasticsearch VilniusPHP

Elasticsearch presentation at VIlnius PHP 2013 09 05

Resources:
http://elasticsearch.org
http://git.io/esp
http://git.io/bigdesk

Simon

September 05, 2013
Tweet

More Decks by Simon

Other Decks in Programming

Transcript

  1. Distributed Based on Apache Lucene HTTP + JSON Document based

    Schema free Real time search Advanced features What is elasticsearch?
  2. Big changes since v0.25 Now its faster More sorting capabilities

    Did you mean support Multiple documents in 1 query *And other 30 millions features (that means a lot)
  3. Setup and run Cool out of the box ;) Download,

    extract or install $ bin/elasticsearch -f
  4. Shards Splits index into parts By default index has 5

    shards Automatically balance data between shards
  5. Data import Support mapping Other columns in type can be

    added Support arrays $ curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d ' { "tweet" : { "properties" : { "message" : {"type" : "string", "store" : "yes"} } } } '
  6. Boost values Each field could have different weight Results will

    be sorted according match $ curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d ' { "tweet" : { "_boost" : {"name" : "my_boost", "null_value" : 3.0} } } '
  7. Filter vs query Filters are cached and faster Could be

    combined Filter is useful for range, max, min, etc.. Query DSL is like AST (abs. syntax tree)
  8. Suggestions Elasticsearch can predict what you had in mind Lists

    results by similarity and frequency $ curl -XPOST http://localhost:9200/_suggest -d ’ { "text": "John", "my-suggestion": { "term": { "field": "name" } } } ‘ my-suggestion: [ { text: jonh offset: 0 length: 4 options: [ { text: john score: 0.85 freq: 15 }, { text: jonathan score: 0.75 freq: 5 } ] } ]
  9. Facets Results can be grouped and counted Group several columns

    at once Also get results { "query": { "query_string": { "query": "Jo*" } }, "facets": { "tags": { "terms": { "field": "country" } } } }
  10. Completion suggest Faster than prefix search Store additional info for

    inserts curl -X PUT localhost:9200/music/song/_mapping -d '{ "song" : { "properties" : { "name" : { "type" : "string" }, "suggest" : { "type" : "completion", "index_analyzer" : "simple", "search_analyzer" : "simple", "payloads" : true } } } }