Elassandra is a distributed storage which built with combining
cassandra. It comes elasticsearch as a cassandra plugin. Basically it has cassandra API as well as elasticsearch API. When data save on cassandra it will automatically index on elasticsearch. It’s an ideal and powerful solutions to achieve full text search on cassandra. Read more about elassandra from here.
I have have a cassandra table
vendors(oui, name, enabled, timestamp) on elassandra cluster. Following is the cassandra schema that I have used to create the vendors table.
I have created vendor elastic index for this table as well. Following is the elastic index of vendors.
I want to add new
Add email filed to cassandra table
To add the filed to cassandra table we can simply execute
ALTER query with
cqlsh. Following is the query.
Then we can insert data to vendors table with new email field. For an example I can insert following record.
This email field not yet reflect in the elasticsearch since no elassandra mapping exists for email field in vendors elasticsearch index. If we execute
GET query to elasticsearch, it will returns vendor without email field.
Update elasticsearch mapping with email field
We can add email field to vendors elasticsearch index by executing
HTTP PUT request on vendors elasticsearch mapping. Following is the way to do that.
Following is the updated vendors elasticsearch index. Now it contains the email field.
Now if you execute
GET query to elasticsearch, it will returns the vendor with email field.