$30 off During Our Annual Pro Sale. View Details »

Elasticsearch on Rails

Elasticsearch on Rails

Andrew Nesbitt

April 16, 2015
Tweet

More Decks by Andrew Nesbitt

Other Decks in Programming

Transcript

  1. Elasticsearch on Rails

    View Slide

  2. ANDREW NESBITT

    View Slide

  3. Distributed full text search
    Based on Lucene
    RESTful web interface
    JSON NoSQL document store
    Scalable multi-tenancy
    What is Elasticsearch?

    View Slide

  4. Web Application Framework
    Model View Controller
    Active Record ORM
    Convention over Configuration
    Extracted from Basecamp
    What is Ruby on Rails?

    View Slide

  5. Full Text Search
    Sorting
    Filtering
    Faceting
    Pagination
    What can we do with it?
    Boosting
    Stemming
    Highlighting
    Document storage
    Analytics

    View Slide

  6. github.com/elastic/elasticsearch-rails

    View Slide

  7. elasticsearch-model
    elasticsearch-rails
    elasticsearch-persistence
    elasticsearch gems

    View Slide

  8. ActiveRecord and Mongoid integration
    ActiveRecord::Relation-based Search
    Kaminari and WillPaginate pagination
    Model Serialization to JSON
    Automatic indexing updating callbacks
    elasticsearch-model

    View Slide

  9. Rake tasks for importing data to ES
    ActiveSupport Instrumentation
    Example application Templates generation
    elasticsearch-rails

    View Slide

  10. Use elasticsearch as a NoSQL database to
    store and retrieve documents using an
    ActiveModel interface.
    elasticsearch-persistence

    View Slide

  11. View Slide

  12. LIVE
    CODING

    View Slide

  13. http://libraries.io

    View Slide

  14. "If I have seen further it is by standing on the shoulders of giants”
    Sir Isaac Newton

    View Slide

  15. Popular?
    Active?
    License?
    Documented?
    Contributor friendly?
    Follows SemVer?
    High bus factor?
    Is it dependable?
    How do you know if a
    library is worth using?

    View Slide

  16. It works by counting the number and
    quality of links to a page to
    determine a rough estimate of how
    important the website is.
    !
    The underlying assumption is that more
    important websites are likely to receive
    more links from other websites.

    View Slide

  17. It works by counting the number and
    quality of dependencies to a library to
    determine a rough estimate of how
    important the library is.
    !
    The underlying assumption is that more
    dependable libraries are likely to be
    more dependent on by other libraries.

    View Slide

  18. View Slide

  19. activesupport
    rails
    memcached
    devise
    waffleiron
    activemerchant

    View Slide

  20. 760,425 projects
    from
    24 package managers
    in
    152 different languages

    View Slide

  21. LIVE
    DEMOING

    View Slide

  22. github.com/ankane/searchkick

    View Slide

  23. Good defaults
    SQL-like query interface
    Zero-downtime reindexing
    Autocomplete
    Lots of nice little touches
    searchkick

    View Slide

  24. github.com/toptal/chewy

    View Slide

  25. Multi-model indexes
    Atomic bulk imports
    Powerful query DSL
    Every index is observable
    by all related models
    chewy

    View Slide

  26. Deployment
    Elasticsearch::Model.client =
    Elasticsearch::Client.new url: ENV['ELASTICSEARCH_URL']

    View Slide

  27. found.no
    qbox.io
    bonsai.io
    compose.io/elasticsearch
    indexisto.com
    Hosted Services

    View Slide

  28. github.com/Asquera/elasticsearch-http-basic

    View Slide

  29. Thanks!
    @teabass
    http://nesbitt.io
    github.com/andrew

    View Slide