Currently, I am experimenting with Elassandra (combination of Elasticsearch and Cassandra). There I have an existing Cassandra keyspace with tables and want to create a mapping to Elasticsearch so that I can use the Elasticsearch API to search/filter the data.
Unfortunately, it does not work and I am not sure why that is.
First of all, I make a PUT request to the Elasticsearch HTTP endpoint to create the mapping:
{
"settings": {
"keyspace": "my_keyspace"
},
"mapping": {
"sensordatatable": {
"discover": ".*"
},
"eventtable": {
"discover": ".*"
}
}
}
Then I get this as answer:
{
"error": {
"root_cause": [
{
"type": "settings_exception",
"reason": "Cannot create index, underlying keyspace requires the NetworkTopologyStrategy."
}
],
"type": "settings_exception",
"reason": "Cannot create index, underlying keyspace requires the NetworkTopologyStrategy."
},
"status": 500
}
In this post (https://github.com/strapdata/elassandra/issues/44#issuecomment-253055846) someone also uses SimpleStrategy
and it seems to work for him. Can someone explain me WHY I have to use NetworkTopologyStrategy
?
As of Elassandra 5+, only NetworkTopologyStrategy
is supported although there is no technical issue preventing to support SimpleStrategy
as well. NetworkTopologyStrategy
is just usually preferred because it allows you to scale multiple data-centers.
By the way, you are trying to create an index over two tables. But since version 6, Elasticsearch supports only one type per index. If you need to index two tables in the same keyspace, you can create two separate indices :
PUT sensordata
{
"settings": {
"keyspace": "my_keyspace"
},
"mapping": {
"_doc": {
"discover": ".*"
}
}
}
and :
PUT event
{
"settings": {
"keyspace": "my_keyspace"
},
"mapping": {
"_doc": {
"discover": ".*"
}
}
}