如何在cassandra中解决OrderBy?

时间:2019-06-25 20:27:13

标签: cassandra

我在Cassandra中遇到此问题,无法通过ORDER使用

这是我的查询

{
    "_id": "e803c7491f63cdf3cb201c867c00d52c",
    "Scenario": "Splunk",
    "Team": "Alpha",
    "CreatedOnUtc": "2019-06-20T21:39:09.5940830Z",
    "CreatedOnLocal": "2019-06-20T17:39:09.5940830-04:00",
    "Participants": [
        {
            "Name": "A",
            "Role": "CSSP"
        }
    ],
    "Observations": [
        {
           "Label": "Generate Incident Report",
        },
        {
            "Label": "Ingest Data",
        },
        {
            "Label": "Generate Data",
        },
        {
            "Label": "Ingest Data",
        }
     ]
}

但是当我使用Order By时,对此有疑问

public static final Select GET_USERS = QueryBuilder.select().all().from("user");

能否请您帮我在查询中使用order by?

1 个答案:

答案 0 :(得分:0)

您需要指定一个分区键以使用order by子句进行查询。下面的SO帖子详细介绍了如何在Cassandra中使用ORDER BY子句。希望这可以帮助您澄清

Where and Order By Clauses in Cassandra CQL