express-cassandra icon indicating copy to clipboard operation
express-cassandra copied to clipboard

Elassandra support not working

Open neven95 opened this issue 5 years ago • 1 comments

My configuration looks like this


 var models = ExpressCassandra.createClient({
    clientOptions: {
        contactPoints: ['127.0.0.1'],
        protocolOptions: { port: 9042 },
        keyspace: 'strat_history_keyspace',
        queryOptions: { consistency: ExpressCassandra.consistencies.one },
        elasticsearch: {
            host: 'http://localhost:9200',
            apiVersion: '6.2.3',
            sniffOnStart: true,
        }
    },
    ormOptions: {
        manageESIndex: true,

        defaultReplicationStrategy: {
            class: 'SimpleStrategy',
            replication_factor: 1
        },
        migration: "drop",
    }
});

but when I tried search like this(HistoryDB==models)

HistoryDB.instance.Smoke.search({
    
       q: 'day:31',
        }, function(err, response) {
            if (err) throw err;
       
        });

I got an error : err while create or update: Error: To use elassandra features, set manageESIndex to true in ormOptions

neven95 avatar Oct 31 '18 09:10 neven95

The replication class has to be 'NetworkTopologyStrategy' (which in turn prevents the use of the 'replication_factor' parameter)

You probably should try to restart from scratch with your database to make sure it works as expected, although I'm here because I also get an error which I don't know how to resolve... see #184

The full declaration must include the data center name and replication factor:

    defaultReplicationStrategy: {
        class: 'NetworkTopologyStrategy',
        DC1: 1
    },

AlexisWilke avatar Dec 04 '18 20:12 AlexisWilke