elasticsearch sql webinar · 2020-06-07 · elasticsearch sql rdbms terminological differences...
TRANSCRIPT
![Page 1: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/1.jpg)
Arthur GimpelSolutions Architect
Elasticsearch SQL Webinar
![Page 2: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/2.jpg)
Agenda
What is Elasticsearch SQL?1
Aggregations3
Geographic queries 4
Text operators and relevancy2
![Page 3: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/3.jpg)
What is Elasticsearch SQL
• SQL interpreter for Elasticsearch queries
• Based on Elasticsearch API’s & ANSI SQL
• Lightweight and scalable
SQL Interface to Elasticsearch
JDBC
ODBC
REST API
CLI
![Page 4: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/4.jpg)
Elasticsearch SQL <> RDBMSTerminological Differences
Relational Databases (RDBMS) Elasticsearch SQL
Column Field
Row Document
Table Index
View Alias
Schema - (Security can enforce “schema”)
Database / Catalog -
Instance / Cluster Cluster / Clusters (Federated via CCS)
![Page 5: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/5.jpg)
Elasticsearch SQL ExecutionSQL Interpreter Internals
SQL Query Unresolved AST
Resolved / Logical Plan
Optimized Plan Physical Plan Client
Results
Analysis PlanningParsing Execution
Query DSL
![Page 6: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/6.jpg)
6
Demo
![Page 7: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/7.jpg)
Agenda
What is Elasticsearch SQL?1
Aggregations3
Geographic queries4
Text operators and relevancy2
![Page 8: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/8.jpg)
Text Operators and Relevancy
• Within the WHERE clause there are two predicates made for full text:‒ MATCH (field(s) to match, matching text, optional parameters)
‒ QUERY (query_string, optional parameters)
• The SCORE() function is used to project the result of the scoring. Can be used in the scope of SELECT, ORDER BY clauses
Fulltext Search with Elasticsearch SQL
"match" : { "full_name" : { "query" : "arthur gimpel", "operator" : "AND“ }}
SELECT …WHERE MATCH('full_name', 'arthur gimpel', ‘operator=and’);
"multi_match" : { "query" : "Lee", "fields" : [ "first_name", "last_name^2.0"] }
SELECT …WHERE MATCH(‘first_name, last_name^2.0’ , ‘Lee’)
![Page 9: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/9.jpg)
9
Demo
![Page 10: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/10.jpg)
Agenda
What is Elasticsearch SQL?1
Functions and Aggregations3
Geographic queries4
Text operators and relevancy2
![Page 11: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/11.jpg)
Aggregate Functions Scalar FunctionsMetric Aggregations: COUNT, SUM, MAX, AVG... Math: ABS, SQRT, LOG, COS, SIN, ACOS, ASIN….
GROUPING (except GROUP BY): HISTOGRAM String: RIGHT,LEFT,SUBSTRING,LENGTH, UCASE...
Conversion: CAST,CONVERT
Date: DAY, MONTH, YEAR, NOW, MONTH_NAME...
Conditional: IIF, ISNULL, CASE, NULLIF, GREATEST... Geo: ST_AsWKT, ST_WKTToSQL, ST_X, ST_Y, ST_Z, ST_Distance...
Functions and AggregationsTypes of Functions in Elasticsearch SQL
![Page 12: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/12.jpg)
Functions and AggregationsGroup By & Having
SELECT column_name, aggregate_function(column_name)
FROM ...
WHERE ...
GROUP BY column_name
HAVING aggregate_function(column_name) operator value;
![Page 13: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/13.jpg)
Functions and AggregationsGroup By & Having
SELECT column_name, aggregate_function(column_name)
FROM ...
WHERE ...
GROUP BY column_name
HAVING aggregate_function(column_name) operator value;
Bucket Agg
Pipeline Agg
Metric Agg
![Page 14: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/14.jpg)
14
Demo
![Page 15: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/15.jpg)
Agenda
What is Elasticsearch SQL?1
Functions and Aggregations3
Geographic queries4
Text operators and relevancy2
![Page 16: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/16.jpg)
Geographic Queries
• Implements OpenGIS Simple Features Implementation Specification for SQL
• Currently supports ST_AsWKT, ST_WKTToSQL, ST_GeometryType, ST_X, ST_Y, ST_Z, ST_Distance
• Internally the Elasticsearch types supported are geo_point and geo_shape containing a point only
Standard GeoSQL Implementation on top of Elasticsearch
JDBC
ODBC
REST API
GeoSQL
![Page 17: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/17.jpg)
17
Demo
![Page 18: Elasticsearch SQL Webinar · 2020-06-07 · Elasticsearch SQL RDBMS Terminological Differences Relational Databases (RDBMS) Elasticsearch SQL Column Field Row Document Table](https://reader030.vdocument.in/reader030/viewer/2022040309/5f1b7df74e77266f5c01a7b3/html5/thumbnails/18.jpg)
18
Q & AThank you