Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elastic Index ignores documents created using Cassandra UPDATE #50

Closed
shohamlevy opened this issue Oct 6, 2016 · 4 comments
Closed

Comments

@shohamlevy
Copy link

I am using elassandra-2.1.1-17

When creating new documents using INSERT, Elastic indexes them. But when using UPDATE to create the new documents - Elastic ignores them. See example:

cqlsh > CREATE KEYSPACE IF NOT EXISTS test
    WITH replication = {
                           'class': 'NetworkTopologyStrategy',
                           'dc1': '1'
                       }
    AND durable_writes = true;

cqlsh > CREATE TABLE test.t1 (
    name text,
    id int,
    nicks set<text>,
    PRIMARY KEY (name, id)
);
$> curl -XDELETE "localhost:9200/test_index?pretty=true" 

$> curl -XPUT "localhost:9200/test_index?pretty=true" -d \
'{
    "settings": {
        "keyspace":"test"
    },
    "mappings": {
            "t1": {
                "properties": {
                    "name": {"type": "string", "cql_collection": "singleton", "index": "not_analyzed", "cql_primary_key_order": 0, "cql_partition_key": true},
                    "id": {"type": "integer", "cql_collection": "singleton", "index": "no", "cql_primary_key_order": 1},
                    "nicks": {"type": "string", "cql_collection": "set", "index": "not_analyzed"}
                }
            }
    }
}' 

Now add a couple of documents:

cqlsh> UPDATE test.t1 SET nicks = nicks + {'abc'} WHERE name='Moses' AND id=14;
cqlsh> INSERT INTO test.t1 (name, id, nicks) VALUES ('Jerry', 33, {'jj', 'jlo'});
cqlsh> SELECT * FROM test.t1 ;
 name  | id | nicks
-------+----+---------------
 Moses | 14 |       {'abc'}
 Jerry | 33 | {'jj', 'jlo'}
(2 rows)

Check results for Elastic (you only see 1 entry, the one added using INSERT):

$> curl -XGET "localhost:9200/test_index/t1/_search?pretty=true"
{
  "took" : 16,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "test_index",
      "_type" : "t1",
      "_id" : "[\"Jerry\",33]",
      "_score" : 1.0,
      "_source":{"name":"Jerry","id":33,"nicks":["jj","jlo"]}
    } ]
  }
}
@shohamlevy shohamlevy changed the title Elastic Index ignored Cassandra UPDATEs Elastic Index ignores documents created using Cassandra UPDATE Oct 6, 2016
@shohamlevy
Copy link
Author

I run some more checks. Apparently ElasticSearch (for Elssandra) does not like to work with Cassandra SET, but only with LIST.

Changing 'nicks' from SET of Strings to LIST of Strings solved some ES query issues I had. But it still does not index UPDATE entries.

@vroyer
Copy link
Collaborator

vroyer commented Oct 11, 2016

Hi,
Yes, there is a bug when updating a collection with a clustering key.
This is fixed for the next release delivered by the end of this week.
Thanks for reporting this issue.
Vincent.

@vroyer
Copy link
Collaborator

vroyer commented Oct 24, 2016

This is fixed in the last release 2.1.1-18.

@shohamlevy
Copy link
Author

Checked, and now it works. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants