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

ElasticSearch 101

ElasticSearch 101

In this talk, I introduce some basic concepts about ElasticSearch and some use cases. Also, I explain how ElasticSearch stores, indexes and retrieve documents.

I believe that after this presentation you'll be able to start playing with ElasticSearch and will be ready for learning more advanced topics.

For more details about the content, head to my blog post about it: http://www.lucassaldanha.com/elasticsearch-101/

Lucas Saldanha

November 05, 2015
Tweet

More Decks by Lucas Saldanha

Other Decks in Programming

Transcript

  1. Agenda • What is ElasticSearch • Basic Concepts • Indexing

    and Searching • Rest API • Inverted index • Analysis • Querying Lucas Saldanha® - http://www.lucassaldanha.com 2
  2. What is ElasticSearch? • Document oriented database • JSON format

    • Built on top of Lucene • Focus on information retrieval features • Good use cases: • Textual search • Data aggregation • Geo Search • JSON document storage Lucas Saldanha® - http://www.lucassaldanha.com 3
  3. Basic Concepts • Cluster: a set of nodes (servers) that

    holds all the data • Node: a single server that holds some data and participate on the cluster’s indexing and querying • Index: a set of documents • Shard: a subset of documents of an index. A index can be divided in many shards • Type: a definition of the schema of documents inside of an index (can be more than one) • Document: a JSON object with some data. It’s the basic unit of information in ES Lucas Saldanha® - http://www.lucassaldanha.com 4
  4. Query API in Action (image taken from the slides of

    the presentation An ElasticSearch Crash Course, by Andrew Cholakian) Lucas Saldanha® - http://www.lucassaldanha.com 7
  5. Inverted Index (image taken from the slides of the presentation

    An ElasticSearch Crash Course, by Andrew Cholakian) Lucas Saldanha® - http://www.lucassaldanha.com 8
  6. Analysis • Breaks chunks of texts in terms (tokens) •

    Helps building the inverted index • ElasticSearch comes with a lot of analyzers (but you can also write yours) • Examples: • Snowball analyzer: remove stop words and transform terms to the stemmed form • “The world tallest building” -> [“world”, “tall”, “building”] • N-gram analyzer: break terms in n-grams (good for autocomplete) • “future” -> [“fut”, “ure”] Lucas Saldanha® - http://www.lucassaldanha.com 9
  7. Querying • ElasticSearch comes a lot of queries types (near

    40 the last time I counted) • You can use the best one for your need • Queries can be combined • Examples: • Term/Phrase query: search documents with a specific list of terms • Geo Query: search documents inside a boundary • Numeric range query: search documents inside some interval Lucas Saldanha® - http://www.lucassaldanha.com 10
  8. References • http://www.lucassaldanha.com/elasticsearch-101/ • https://www.elastic.co/guide/en/elasticsearch/reference/current/ind ex.html • https://www.elastic.co/videos/an-elasticsearch-crash-course • https://www.loggly.com/blog/loggly-chose-elasticsearch-reliable-

    scalable-log-management/ • http://www.slideshare.net/kucrafal/scaling-massive-elastic-search- clusters-rafa-ku-sematext • https://www.elastic.co/guide/en/elasticsearch/guide/current/relevan ce-intro.html Lucas Saldanha® - http://www.lucassaldanha.com 11