elassandra icon indicating copy to clipboard operation
elassandra copied to clipboard

What's the right approach for creating Keyspace/Tables/CRUD operations

Open jasonever opened this issue 5 years ago • 3 comments

Hi,

I'm new to elassandra .. I was reading the document there . and noticed various examples for ES API :

  1. Creating Keyspace
  2. Creating Tables
  3. 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 ?

jasonever avatar Jan 09 '20 22:01 jasonever

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.

vroyer avatar Jan 10 '20 08:01 vroyer

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 :

  1. Via Elasticsearch API POST
  2. Elastic would store the data in Cassandra
  3. Elastic would create the index (For elastics , not for Cassandra)
  4. 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 :

  1. Creating Keyspace + Table using Cqlsh 2- Inserting values normally using Cqlsh 3- Creating the required indexes using ElasticAPI 4- Using Cqlsh for searching.

Is this doable ? Can you guide me with a few samples or to share its part in the document ?

Thanks

jasonever avatar Jan 20 '20 18:01 jasonever

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

leleueri avatar Feb 17 '20 08:02 leleueri