DynamoDB query filtering with global secondary index

I am using a global secondary index to query my table and want to be able to filter the results based on other attributes (the SQL equivalent would be a WHERE clause)). Scanning allows me to do this, but is it possible with a query? What other approaches can I take?

var params = {
                "IndexName": "City-index",
                "KeyConditions": {
                    "City": {
                        "AttributeValueList": [{
                            "S": city
                        }],
                        "ComparisonOperator": "EQ"
                    }

                },
                "Limit": "100",
                "TableName": "properties"
            }
            dynamoDB.query(params, function(err, data) {
                if (err) {
                    console.log(err);
                } else {
                    console.log(data);
                }

            });

Any other ideas on how I can create a TABLE to achieve:

Hash Key: propertyID (unique)
Range Key: createdAt (unique

Global Secondary Indexes: City
Global Secondary Indexes: State

I would like to be able to query the index and then filter on other attributes (bedrooms, bathrooms, etc.).

+4
source share
1 answer

, GSI - 5 . , ( : EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN)

, , - - RDS. , Cloudsearch.

+2

Source: https://habr.com/ru/post/1526182/


All Articles