• This repository has been archived on 01/Mar/2023
  • Stars
    star
    204
  • Rank 192,063 (Top 4 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created almost 11 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Discontinued in favour of Cassandra Lucene Index

This project has been discontinued in favour of Cassandra Lucene Index, which maintains exactly the same features being a plugin of Apache Cassandra instead of a fork. It is worth noting that plugin distribution is rather preferred than a fork, which is harder to maintain. This have been possible thanks to CASSANDRA-8717, among others.

Stratio Cassandra

Stratio Cassandra is a fork of Apache Cassandra where index functionality has been extended to provide near real time search such as ElasticSearch or Solr, including full text search capabilities and free multivariable search. It is achieved through an Apache Lucene based implementation of Cassandra secondary indexes, where each node of the cluster indexes its own data. Stratio Cassandra is one of the core modules on which Stratio's BigData platform (SDS) is based.

Index relevance queries allows you to retrieve the n more relevant results satisfying a query. The coordinator node sends the query to each node in the cluster, each node returns its n best results and then the coordinator combines these partial results and gives you the n best of them, avoiding full scan. You can also base the sorting in a combination of fields.

Index filtered queries are a powerful help when analyzing the data stored in Cassandra with MapReduce frameworks as Apache Hadoop or, even better, Apache Spark through Stratio Deep. Adding Lucene filters in the jobs input can dramatically reduce the amount of data to be processed, avoiding full scan.

Any cell in the tables can be indexed, including those in the primary key as well as collections. Wide rows are also supported. You can scan token/key ranges, apply additional CQL3 clauses and page on the filtered results.

More detailed information is available at Stratio Cassandra documentation .

Features

Stratio Cassandra and its integration with Lucene search technology provides:

  • Big data full text search
  • Relevance scoring and sorting
  • General top-k queries
  • Complex boolean queries (and, or, not)
  • Near real-time search
  • Custom analyzers
  • CQL3 support
  • Wide rows support
  • Partition and cluster composite keys support
  • Support for indexing columns part of primary key
  • Third-party drivers compatibility
  • Spark compatibility
  • Hadoop compatibility

Not yet supported:

  • Thrift API
  • Legacy compact storage option
  • Indexing counter columns
  • Columns with TTL
  • CQL user defined types
  • Static columns

Requirements

  • Java >= 1.7 (OpenJDK and Sun have been tested)
  • Ant >= 1.8

Building and running

Stratio Cassandra is distributed as a fork of Apache Cassandra, so its building, installation, operation and maintenance is overall identical. To build and run type:

ant build
bin/cassandra -f

Now you can do some tests using the Cassandra Query Language:

bin/cqlsh

The Lucene's index files will be stored in the same directories where the Cassandra's will be. The default data directory is /var/lib/cassandra/data, and each index is placed next to the SSTables of its indexed column family.

For more details about Apache Cassandra please see its documentation.

Example

We will create the following table to store tweets:

CREATE KEYSPACE demo
WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1};
USE demo;
CREATE TABLE tweets (
    id INT PRIMARY KEY,
    user TEXT,
    body TEXT,
    time TIMESTAMP,
    lucene TEXT
);

We have created a column called lucene to link the index queries. This column will not store data. Now you can create a custom Lucene index on it with the following statement:

CREATE CUSTOM INDEX tweets_index ON tweets (lucene) 
USING 'com.stratio.cassandra.index.RowIndex'
WITH OPTIONS = {
    'refresh_seconds' : '1',
    'schema' : '{
        fields : {
            id   : {type : "integer"},
            user : {type : "string"},
            body : {type : "text",  analyzer : "english"},
            time : {type : "date", pattern  : "yyyy/MM/dd"}
        }
    }'
};

This will index all the columns in the table with the specified types, and it will be refreshed once per second.

Now, to query the top 100 more relevant tweets where body field contains the phrase "big data gives organizations":

SELECT * FROM tweets WHERE lucene='{
	query : {type:"phrase", field:"body", values:["big","data","gives","organizations"]}
}' limit 100;

To restrict the search for tweets within a certain date range, then you must add to the search a filter as follows:

SELECT * FROM tweets WHERE lucene='{
    filter : {type:"range", field:"time", lower:"2014/04/25", upper:"2014/04/1"},
    query  : {type:"phrase", field:"body", values:["big","data","gives","organizations"]}
}' limit 100;

To refine the search to get only the tweets written by users whose name starts with "a":

SELECT * FROM tweets WHERE lucene='{
    filter : {type:"boolean", must:[
                   {type:"range", field:"time", lower:"2014/04/25", upper:"2014/04/1"},
                   {type:"prefix", field:"user", value:"a"} ] },
    query  : {type:"phrase", field:"body", values:["big","data","gives","organizations"]}
}' limit 100;

To get the 100 more recent filtered results you can use the sort option:

SELECT * FROM tweets WHERE lucene='{
    filter : {type:"boolean", must:[
                   {type:"range", field:"time", lower:"2014/04/25", upper:"2014/04/1"},
                   {type:"prefix", field:"user", value:"a"} ] },
    query  : {type:"phrase", field:"body", values:["big","data","gives","organizations"]},
    sort  : {fields: [ {field:"time", reverse:true} ] }
}' limit 100;

Finally, if you want to restrict the search to a certain token range:

SELECT * FROM tweets WHERE lucene='{
    filter : {type:"boolean", must:[
                   {type:"range", field:"time", lower:"2014/04/25", upper:"2014/04/1"},
                   {type:"prefix", field:"user", value:"a"} ] },
    query  : {type:"phrase", field:"body", values:["big","data","gives","organizations"]}
}' AND token(id) >= token(0) AND token(id) < token(10000000) limit 100;

This last is the basis for Hadoop, Spark and other MapReduce frameworks support.

Please, refer to the comprehensive Stratio Cassandra documentation.

More Repositories

1

cassandra-lucene-index

Lucene based secondary indexes for Cassandra
Java
597
star
2

sparta

Real Time Analytics and Data Pipelines based on Spark Streaming
Scala
525
star
3

Decision

Powered by Spark Streaming & Siddhi
Java
315
star
4

Spark-MongoDB

Spark library for easy MongoDB access
Scala
306
star
5

spark-rabbitmq

RabbitMQ Spark Streaming receiver
Scala
201
star
6

deep-spark

Connecting Apache Spark with different data stores [DEPRECATED]
Java
196
star
7

crossdata

DISCONTINUED - Easy access to big things. Library for Apache Spark extending and improving its capabilities
Scala
169
star
8

ingestion

Flume - Ingestion, an Apache Flume distribution
Java
147
star
9

khermes

A distributed fake data generator based in Akka.
Scala
92
star
10

stratio-connector-mongodb

(DEPRECATED) A crossdata connector to MongoDB
Java
77
star
11

stratio-connector-decision

(DEPRECATED) A connector for stratio streaming
Java
73
star
12

stratio-connector-elasticsearch

(DEPRECATED) noverify
Java
72
star
13

stratio-connector-cassandra

(DEPRECATED) Native connector for Cassandra using Crossdata
Java
72
star
14

stratio-connector-commons

(DEPRECATED) The common module for the stratio connectors
Java
72
star
15

stratio-connector-deep

(DEPRECATED) Deep connector for multiple data sources
Java
70
star
16

stratio-connector-sparkSQL

(DEPRECATED) A crossdata connector to Spark SQL
Scala
67
star
17

stratio-connector-hdfs

(DEPRECATED) HDFS
Scala
66
star
18

crossdata-connector-skeleton

(DEPRECATED) Skeleton project that can be used to implement Crossdata connectors
Java
62
star
19

vagrant-ova-plugin

Vagrant plugin that export a box from vbox to vmwware
Ruby
61
star
20

datasource-receiver

Spark Receiver for SQL or NoSQL Databases like Cassandra, MongoDB, Elasticsearch or JDBC
Scala
42
star
21

egeo-starter

Egeo Starter is a Boilerplate project prepared for work with Egeo 1.x, Angular 2.x, TypeScript, Webpack, Karma, Jasmine and Sass.
TypeScript
40
star
22

kafka-elasticsearch-sink

Java
31
star
23

incubator-toree

Scala
30
star
24

valkiria

Go
29
star
25

rocket-examples

Sparta 2.x examples: workflows, plugins, sdk, docker ...
Scala
16
star