Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL in Solr Michael Suzuki.

Similar presentations


Presentation on theme: "SQL in Solr Michael Suzuki."— Presentation transcript:

1 SQL in Solr Michael Suzuki

2 Solr is now bilingual!

3 Overview State of play How does it work Why is it important
Sample queries Lost in translation Predicates in SQL Demo

4 State of play Solr SQL introduced in Solr 6, 2016.
Ported to use Calcite over Presto SQL Parser, 2017. It is a feature that is only supported in Solr 6 Cloud. There is work underway to port it to a standalone Solr. ODBC coming soon via calcite Phoenix.

5 How does it work It treats a Solr collection as a table.
It translates SQL statement to streaming expression. Uses the Solr streaming expression API.

6 Why is it important Another way to query.
SQL skill is more common and widely used. Hides Solr’s complexity and its various features. Existing reporting tools work with JDBC drivers.

7 Sample queries: How many films? select params={q=*:*&fl=numFound}
select count(*) from films Which actor played the most leading roles? select params={q=*:*&json.facet={"actor_1_name":{"type":"terms","field":"actor_1_name","sort":{"count":"desc"}," facet":{}}}} select actor_1_name, count(*)from films group by actor_1_name order by count(*) desc Which director has the highest gross? select params={q=*:*&json.facet={"director_name":{"type":"terms","field":"director_name","limit":125,"sort":{"facet _0":"desc"},"facet":{"facet_0":"sum(gross)"} select director_name,sum(gross) from films group by director_name order by sum(gross) desc

8 Lost In Translation Solr is not a database.
SELECT * FROM TABLE; is not supported. LIKE is not supported. Not Null is not supported.

9 Solr Predicates in SQL select movie_title from films where title_year = '[2013 TO 2015]' select movie_title, imdb_score from films where (actor_1_name ='Johnny Depp' and (imdb_score = '[7 TO *]')) select movie_title, title_year from films where _query_ = 'movie_title:B*' and title_year > 2014 Not null work around: select movie_title, title_year from films where _query_ = 'movie_title:*'

10 Demo

11 @suzukimichael @alfresco
Thank you @suzukimichael @alfresco


Download ppt "SQL in Solr Michael Suzuki."

Similar presentations


Ads by Google