With the introduction of Cassandra indexing, it has become possible to perform certain search operations on Cassandra Column Families. BAM event and activity search features have been implemented by using these functionalities.
Search query language
We have defined very simple query language to perform search operations on streams.
<stream_name>.<property><condition><property_value> <operation> <stream_name>.<property><condition><property_value> Example : bam_mediation_stats_data_publisher.stats_type=Endpoint AND bam_mediation_stats_data_publisher.host=10.100.12.53
Note the following regarding the above query:
- stream_name - Stream definition name. ex : 'bam_mediation_stats_data_publisher'
property - Data property name of a stream. There should be a created custom index for this property except for 'Timestamp' and for the properties defined as fixed search properties. See Indexing in Cassandra.
- condition - Supported conditions are, >, <, =, >=, <=, %(contains), !(does not contain)
- operation - Supported join operations are, OR, AND
Also, note the following:
- Filters based on 'Timestamp' can be given in search queries without adding a custom index to Timestamp. Timestamp value should be given in 'yyyyMMddHHmmss' or 'yyyyMMdd' format.
- Example :
bam_mediation_stats_data_publisher.stats_type=Endpoint AND bam_mediation_stats_data_publisher.host=10.100.12.53 AND bam_mediation_stats_data_publisher.Timestamp>20131015000000
- Example :
- But if search query is having only one filter and it is Timesamp, there should be a created custom index for Timestamp.
- Example :
bam_mediation_stats_data_publisher.Timestamp>20131015000000
- Example :
- Filters based on fixed search properties can be given in search queries without adding a custom indexes to them. But they should be used in combinations with other filters, not alone.
- Example :
bam_mediation_stats_data_publisher
.Version=1.0.0 AND bam_mediation_stats_data_publisher.stats_type=Endpoint AND bam_mediation_stats_data_publisher.host=10.100.12.53
- Example :
- Multiple streams can be defined in a single search query.
- Example :
bam_mediation_stats_data_publisher.Timestamp>20131015000000 AND bam_service_data_publisher.Timestamp>20131015000000
- Example :
- All streams search queries can also be performed. In this case, only the streams that have defined custom indexes for given properties will be taken into consideration. For example let's say we need get all the events that has been published to BAM during a given time period. We can get the results by performing below query
*.Timestamp>20131015000000 AND *.Timestamp<20131016120000