elassandra
elassandra copied to clipboard
What's the right approach for creating Keyspace/Tables/CRUD operations
Hi,
I'm new to elassandra .. I was reading the document there . and noticed various examples for ES API :
- Creating Keyspace
- Creating Tables
- Inserting/updating rows
and also I found similar approach but using CQL in addition to that I saw some cases for altering the tables/keyspaces using CQL and not using Elastic API
So I'm confused a little bit about the right method to use here .. I want to use only one method that covers all cases there , I'm leaning to CQL , What do you think ? Isn't using CQL only enough, is it ?
There is many ways, through CQL or the Elasticsearch API, and both have pro and cons, depending on you goals and your application. For example, bluk insert through the Elasticsearch API require a lot of memory (the bulk content is loaded into the coordinator node memory) while insert/update through the CQL goes directly to the right node if you use the CQL driver tokenAware policy. So, i'm not going to give a full course here but strapdata can deliver training sessions.
Thanks @vroyer
Sorry but just let me make sure that I got your point correctly , especially I'm new to ELassandra ..
So the usual way for inserting the data (regardless its volume) , is by :
- Via Elasticsearch API
POST
- Elastic would store the data in Cassandra
- Elastic would create the index (For elastics , not for Cassandra)
- I have the option then to search whether from Cassandra itself or via Elasticsearch Question: The primary key where would it be stored in this case?
So the question from another perspective , Can I do something like this :
- Creating Keyspace + Table using
Cqlsh
2- Inserting values normally usingCqlsh
3- Creating the required indexes usingElasticAPI
4- UsingCqlsh
for searching.
Is this doable ? Can you guide me with a few samples or to share its part in the document ?
Thanks
Hi,
Both ways are possible.
If you ingest data thought ES API, data will be stored in the Cassandra table. The Primary key will also be store in cassandra table according to the mapping definition you have done using cql_primary_key_order and cql_partition_key : https://elassandra.readthedocs.io/en/latest/mapping.html#type-mapping
If you ingest your data throught CQL, data will be send to the ES index. https://elassandra.readthedocs.io/en/latest/architecture.html#write-path
Searching through CQL is also possible : https://elassandra.readthedocs.io/en/latest/search_over_cql.html