Apache Lucene
You can add the Apache Lucene add-on to Apache Cassandra clusters to avail the functionality of indexing cluster data which allows you to search on the cluster data at blazing speed.
With Lucene index, you get advanced search capabilities including full-text search, multivariable, geospatial and bi-temporal search.
In this example, we will create a Lucene index and search using the index.
- Creating Lucene Index
1 2 3 4 5 6 7 8 9 10 |
CREATE CUSTOM INDEX test_index ON test () USING 'com.stratio.cassandra.lucene.Index' WITH OPTIONS = { 'refresh_seconds': '1', 'schema': '{ fields: { si: {type: "integer"}, name: {type: "string"}, gender: {type: "string"} } }' }; |
- Searching using index with one field
1 2 3 |
SELECT * FROM test WHERE expr(test_index, '{ query : {type:"match", field:"name", value:"kinley"} }'); |
- Searching using index with multiple field
1 2 3 4 5 6 |
SELECT * FROM test WHERE expr(test_index, '{ query : [ {type:"match", field:"name", value:"kinley"}, {type:"match", field:"gender", value:"male"} ] }'); |
By Instaclustr Support
Need Support?
Experiencing difficulties on the website or console?
Already have an account?
Need help with your cluster?
Contact Support
Why sign up?