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

Search, Stay Relevant

Avatar for Taha Taha
August 08, 2018

Search, Stay Relevant

This is an introduction to search using elasticsearch and the elastic stack.
It was hosted at GoMyCode @ Tunis.
https://www.eventbrite.com/e/search-and-stay-relevant-tickets-48487421182

Avatar for Taha

Taha

August 08, 2018
Tweet

Other Decks in Technology

Transcript

  1. 2 Taha Derouiche • Consulting Engineer @ elastic • 6

    years in various tech roles • 2 years elasticsearch • https://www.linkedin.com/in/tahaderouiche • [email protected] Who am I?
  2. 3 Agenda Introduction to search Elasticsearch and elastic stack Full-text

    search explained Other use cases of the elastic stack Questions 1 2 3 4 5
  3. 8

  4. 12 All this. Secure Multi-lingual Query language Drill down APIs

    Enrichment Alerting Query Language Unstructured Search Type ahead High availability Fast Highlighting Scalable
  5. 13 Elastic has all this. Secure Multi-lingual Query language Real-time

    Drill down APIs Data Sources Enrichment Alerting Query Language Unstructured Search Type ahead High availability Fast Highlighting Scalable
  6. 14 That's the end goal of elasticsearch: We want to

    make data exploration, the ability to go ahead and ask questions on your data and get results in milliseconds, available to end users. Shay Bannon dotScale 2013
  7. Millions of Downloads 225 2012 Cumulative downloads of all Elastic

    products, including Elasticsearch, Kibana, Beats, and Logstash 1 2018 …
  8. 21 21 "query": { "bool": { "must": [ { "multi_match":

    { "query": "white shirt", "fields": [ "product_name^1", "product_name.english^1", "slug", "description^1", "description.english^1", "manufacturer", "category", "attributes.gender" ], "operator": "or", "minimum_should_match": "50%", "type": "best_fields" } } ] } }
  9. 23 Demo walkthrough • https://github.com/tahaderouiche/elasticsearch-gomycode • Prerequisites: ‒ Elasticsearch Service

    on Elastic Cloud: Free trial OR ‒ Docker + Docker compose: Setup locally Steps Source: Gray Arial10pt
  10. 33 "tokens": [ { "token": "i", "start_offset": 0, "end_offset": 1,

    "type": "<ALPHANUM>", "position": 0 }, { "token": "either", "start_offset": 7, "end_offset": 13, "type": "<ALPHANUM>", "position": 2 }, ... ]
  11. 34 34 GET /_analyze { "char_filter": [ "html_strip" ], "tokenizer":

    "standard", "filter": [ "lowercase", "stop" ], "text": "I will either find a <em>way</em> or make one." }
  12. 35 Stop words a an and are as at be

    but by for if in into is it no not of on or such that the their then there these they this to was will with
  13. 38 38 Languages Arabic, Armenian, Basque, Brazilian, Bulgarian, Catalan, CJK,

    Czech, Danish, Dutch, English, Finnish, French, Galician, German, Greek, Hindi, Hungarian, Indonesian, Irish, Italian, Latvian, Lithuanian, Norwegian, Persian, Portuguese, Romanian, Russian, Sorani, Spanish, Swedish, Turkish, Thai
  14. 41 41 " I will either find a way or

    make one.” " I will either find a way or create one.”
  15. 42 PUT /hannibal { "settings": { "analysis": { "filter": {

    "my_synonym_filter": { "type": "synonym", "synonyms": [ "make,create" ] } },
  16. 43 "analyzer": { "my_analyzer": { "char_filter": [ "html_strip" ], "tokenizer":

    "standard", "filter": [ "lowercase", "stop", "my_synonym_filter" ] } } }
  17. 44 "mappings": { "_doc": { "properties": { "quote": { "type":

    "text", "analyzer": "my_analyzer" } } } }
  18. 45 45 PUT /hannibal/_doc/1 { "quote": "I will either find

    a <em>way</em> or make one." } PUT /hannibal/_doc/2 { "quote": "I have come not to make war on the Italians, but to aid the Italians against Rome." } PUT /hannibal/_doc/3 { "quote": "God has given to man no sharper spur to <b>victory</b> than contempt of death." }
  19. 51 "hits": { "total": 2, "max_score": 0.4121213, "hits": [ {

    "_index": "hannibal", "_type": "_doc", "_id": "1", "_score": 0.4121213, "_source": { "quote": "I will either find a <em>way</em> or make one." } }, { "_index": "hannibal", "_type": "_doc", "_id": "2", "_score": 0.40594208, "_source": { "quote": "I have come not to make war on the Italians, but to aid the Italians against Rome." } } ] }
  20. 56 !"# $%&' = 1 + log( /012345 634789:;< )

    Inverse Document Frequency