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

Indexing The World Into Elasticsearch

Dd9d954997353b37b4c2684f478192d3?s=47 Elastic Co
February 23, 2017

Indexing The World Into Elasticsearch

This meetup talk dove into Elasticsearch's Geo features and demonstrate how to use them to build a location-based search application.

https://www.meetup.com/Silicon-Valley-Elastic-Fantastics/events/237533555/

Dd9d954997353b37b4c2684f478192d3?s=128

Elastic Co

February 23, 2017
Tweet

Transcript

  1. Indexing The Into The Elastic Stack @talevy

  2. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited Introduction to Elasticsearch 1 Geo Points 2 Geo Shapes 3 Indexing Documents As Geo 4 Geo Queries 5 Geo Suggestions 6 Geo Aggregations 7 Geo & Kibana 8 Geo? 9 Did I say Geo? 10 Agenda 2
  3. Elastic…search?

  4. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited What is Elasticsearch? 4 Elasticsearch is an open source, distributed search and analytics engine, designed for horizontal scalability, reliability, and easy management.
  5. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited How do I index Documents? 5 POST my_index/books/1 { "title" : “Elasticsearch In Action", "price" : 35.39 }
  6. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited How do I search Documents? 6 POST my_index/_search { "query": { "bool": { "must": { "match": { "title": "elasticsearch" } }, "filter": { "range": { "price": { "lt": 40 } } } } } }
  7. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited What if my document has a location? 7 POST my_index/books/1 { "title" : “Elasticsearch In Action", "price" : 35.39, “sold_at”: { “lat”: 87.63, “lon”: -122.53 } }
  8. Geo Types

  9. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited Elasticsearch Mappings 9 Mapping is the process of defining how a document, and the fields it contains, are stored and indexed. For instance, use mappings to define: - which fields contains numbers or dates - which strings should be treated as full-text fields - which fields are geolocations
  10. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited Elasticsearch Types 10 ๏text ๏keyword ๏date ๏long ๏double ๏boolean ๏… ๏geo_point ๏geo_shape
  11. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited Geo Point 11 POST my_index/my_location/1 { “location_latlon" : { “lat”: 123, “lon”: 32}, “location_string” : “42.31, -122.52”, “location_array” : [-122.52, 42.31] }
  12. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited Geo Point 12
  13. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited Geo Shape 13 { "location" : { "type": "geometrycollection", "geometries": [ { "type": "point", "coordinates": [100.0, 0.0] }, { "type": "linestring", "coordinates": [ [101.0, 0.0], [102.0, 1.0] ] } ] } }
  14. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited Geo Shape 14
  15. Querying Geo Documents

  16. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited Queries 16 ‣ geo_shape ‣ filter documents relative to a geo_shape in the query ‣ requires geo_shape type ‣ geo bounding box ‣ filter documents based on a… bounding box ‣ geo distance ‣ filter documents within specific distance ‣ geo polygon ‣ filter documents that fall within polygon
  17. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited Working With Results And Ranking 17 ‣ Function Score Queries ‣ boost documents that are closer to specific location
  18. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited Aggregations 18 ‣ geo distance ‣ distance ring buckets around an origin point ‣ Geo Hash ‣ splits documents into equal-sized buckets forming a grid over a region. Context Suggestion ‣ suggest documents based on input and distance
  19. Explore: SF Businesses

  20. Copyright Elasticsearch BV 2015-2017 Copying, publishing and/or distributing without written

    permission is strictly prohibited SF Data 20
  21. Thank you! for deeper dive in geo structures: https://www.elastic.co/webinars/new-geo-capabilities-for- elasticsearch-5.0

    for meetup demo code: https://gist.github.com/anonymous/ cd50a68a5f8bc55a57040f435d439339