DataStax: Enabling Search in your Cassandra Application with DataStax Enterprise

20
Lead Technical Evangelist- Datastax Enterprise @RachelPedreschi Rachel Pedreschi Enabling Search in your Cassandra Application with Datastax Enterprise 1

Transcript of DataStax: Enabling Search in your Cassandra Application with DataStax Enterprise

Lead Technical Evangelist- Datastax Enterprise @RachelPedreschi

Rachel Pedreschi

Enabling Search in your Cassandra Application with Datastax Enterprise

1

What is Search?

Confidential

Confidential

Confidential

The bright blue butterfly hangs on the breeze.

[the] [bright] [blue] [butterfly] [hangs] [on] [the] [breeze]

Terms

Confidential Credit: https://developer.apple.com/library/mac/documentation/userexperience/conceptual/SearchKitConcepts/searchKit_basics/searchKit_basics.html

What is Solr Missing?

Not a Database

Doesn’t Cluster

Not transparently

sharded

Requires ETL to injest

application data

Doesn’t Reindex

Confidential

Cassandra

✓Highly available

✓Linear scalability

✓Low latency OLTP queries

Confidential

+ =

Confidential

Its Not ETL, Its Replication!

C* C* C*/ Solr

Data stored in Cassandra

Indexes stored in Solr/Lucene

Disk

Memory

Solr Cassandra

Disk

Memory

Mem-Table

Index Segments

Ram Buffer

Index Segments

Index Segments

Mem-Table

Mem-table

Index Segments

SSTables

Commit Log

Coordinator

Index Segments

Shard Router

UPDATE videos (videoid, tags)SET tags = {‘cat tubes’, ‘Al Gore’s Internet’, ‘NoSQL Fairytales’}WHERE voided = b3a76c6b-7c7f-4af6-964f-803a9283c401

OSS Solr

Disk

Memory

Index Segments

Ram Buffer

Index Segments

Index Segments

Index Segments

Index Segments

Not Searchable

Searchable

DSE Search

Disk

Memory

Index Segments

Ram Buffer

Index Segments

Index Segments

Index Segments

Index Segments

Searchable

Confidential

Let’s see this in action!

Confidential

// Videos by idCREATE TABLE videos ( videoid uuid, userid uuid, name text, description text, location text, location_type int, preview_image_location text, tags set<text>, added_date timestamp, PRIMARY KEY (videoid));

How can we search on tags?

// Index for tag keywordsCREATE TABLE videos_by_tag ( tag text, videoid uuid, added_date timestamp, userid uuid, name text, preview_image_location text, tagged_date timestamp, PRIMARY KEY (tag, videoid));

Confidential

// Videos by idCREATE TABLE videos ( videoid uuid, userid uuid, name text, description text, location text, location_type int, preview_image_location text, tags set<text>, added_date timestamp, PRIMARY KEY (videoid));

Or this?

But what about th

is?

Confidential

Behind the scenes…dse_tool

schema.xmlsolrconfig.xml

CQL Query$ dsetool create_core killrvideo.videos generateResources=true

<?xml version="1.0" encoding="UTF-8" standalone="no"?><schema name="autoSolrSchema" version="1.5"><types>…<fields><field indexed="true" multiValued="false" name="added_date" stored="true" type="TrieDateField"/><field indexed="true" multiValued="false" name="location" stored="true" type="TextField"/><field indexed="true" multiValued="false" name="preview_image_location" stored="true" type="TextField"/><field indexed="true" multiValued="false" name="name" termVectors="true" stored="true" type="TextField"/><field indexed="true" multiValued="true" name="tags" termVectors="true" stored="true" type="TextField"/><field indexed="true" multiValued="false" name="userid" stored="true" type="UUIDField"/><field indexed="true" multiValued="false" name="videoid" stored="true" type="UUIDField"/><field indexed="true" multiValued="false" name="location_type" stored="true" type="TrieIntField"/><field indexed="true" multiValued="false" name="description" termVectors="true" stored="true" type="TextField"/></fields><uniqueKey>videoid</uniqueKey></schema>

<!--======= Copyright DataStax, Inc. Please see the included license file for details.--><!-- For more details about configurations options that may appear in this file, see http://wiki.apache.org/solr/SolrConfigXml.--><config> <!-- In all configuration below, a prefix of "solr." for class names is an alias that causes solr to search appropriate packages, including org.apache.solr.(search|update|request|core|analysis) You may also specify a fully qualified Java classname if you have your own custom plugins. -->…

SELECT * FROM killrvideo.videos WHERE solr_query=‘name:*’

Thank you!

20