What I needed to understand to be productive with Elasticsearch and Tire – Document Oriented – Restful – Searching Basics (Basic queries, Facets) What will we be talking about?
book authors who have written books with “Apple” in title • Searching text for words that sound like “season” • Auto-completing a search box based on previously issued searches while accounting for mis-spellings http://exploringelasticsearch.com/book/an-overview/what-is-elasticsearch.html
how many items are left in the inventory – Figuring out the sum of all line-items on all the invoices sent out in a given month – Executing two operations transactionally with rollback support – Creating records that are guaranteed to be unique across multiple given terms, for instance a phone number and extension http://exploringelasticsearch.com/book/an-overview/what-is-elasticsearch.html
Standalone database server, written in Java, that takes data in and stores it in a sophisticated format optimized for language based searches • Main protocol is implemented with HTTP/JSON
• High availability • Restful api • Multi-tenancy • Full text search • Conflict management • Schema free • Real time data • Per-operation persistence • Apache 2 open source license • Build on top of apache lucene ™ What I needed to understand to be productive
defined type and has one or many values of that type. • Contains a single piece of data: – Like the number 42 – The string "Hello, World!" – An array like: [5, 6, 7, 8].
documents of that type. • Each document has a type mapping – Either user-defined, or – Inferred • Defines the types of its fields (integer, string, etc.) http://exploringelasticsearch.com/
movies by – Movie description – Movie name – Actor name • Sort results in direction • Sort results by an attribute • Facet on genre – Aggregate counts of distinct genres within the result-set
for Elasticsearch. • ActiveModel integration in Rails applications • At this point, ElasticSearch and Tire would just work • No type mapping provided • Elasticsearch infers type mapping • But....would only be able to search attributes on Movie model/table Include Tire Index name
Indexed document represents a denormalized table – Do not perform joins in index Tire : Search Basics Create Elasticsearch documents. Now, we need custom type mapping Tire method
to the task of restricting the result set, scoring, then sorting • Searches are handled by Search API. This API has several other APIs nested inside of it: • Query DSL, • Filter API, • Facet API, and • Sort API.
• Maximum result set size, • Result offset location • Search phrases • 'fuzzy' querying ("skateboarig" matches 'skateboarding”) • 36 different query types, and 25 different filter types
to search movies by – Movie description – Movie name – Actor name • Sort results in direction • Sort results by • Facet on genre – Aggregate counts of distinct genres within the result-set