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

Data Science Master. ElasticSearch and Kibana. Session 4: Querying ElasticSearch

Data Science Master. ElasticSearch and Kibana. Session 4: Querying ElasticSearch

Introduction to the REST API provided by ElasticSearch.

Daniel Izquierdo Cortazar

April 21, 2017
Tweet

More Decks by Daniel Izquierdo Cortazar

Other Decks in Technology

Transcript

  1. ElasticSearch DSL Two main contexts: Query: looking for matches How

    well does this document match with this query? Filter: filtering data as in SQL Does this document match with this query? Daniel Izquierdo Cortázar Máster en Data Science. ETSII. 3
  2. ElasticSearch DSL And we can match, term or range queries

    So we can query + match or filter + term. Daniel Izquierdo Cortázar Máster en Data Science. ETSII. 4
  3. ElasticSearch DSL Match: accepts text/numerics/dates GET /_search { "query": {

    "match" : { "message" : "this is a test" } } } Daniel Izquierdo Cortázar Máster en Data Science. ETSII. 5
  4. ElasticSearch DSL Term: look for the exact value GET my_index/my_type/_search

    { "query": { "term": { "status": "open" } } } Daniel Izquierdo Cortázar Máster en Data Science. ETSII. 6
  5. ElasticSearch DSL Ranges: numerics and dates GET _search { "query":

    { "range" : { "date" : { "gte" : "now-1d/d", "lt" : "now/d" } } } } Daniel Izquierdo Cortázar Máster en Data Science. ETSII. 7