Comments (1)
I just noticed there is a second request after the first that had this:
2020-05-19 16:17:05,551 DEBUG o.a.h.i.c.Wire [http-thread-pool::http-listener-2(4)] http-outgoing-0 >> "{"TableName":"Movie","IndexName":"idx_global_movie_collection_id","Select":"ALL_PROJECTED_ATTRIBUTES","KeyConditions":{"collectionId":{"AttributeValueList":[{"S":"aee7db6b-727a-4b2a-970e-a53ca72b1ef0"}],"ComparisonOperator":"EQ"}}}"
So that is interesting. After closer inspection, I realized I still had an old request I generated manually using a DynamoDBTemplate, and that was the failing request. Actually, it's rather nice that I have both now as it will help me to understand how to correctly form the request manually.
Here is the revised manual query, in case it helps someone. What was missing from it was the calls to set index name and consistent read to false.
Map<String, AttributeValue> parms = new HashMap<String, AttributeValue>();
parms.put(":collectionId", new AttributeValue().withS(collectionId));
DynamoDBQueryExpression<Movie> queryExpression = new DynamoDBQueryExpression<Movie>()
.withIndexName("idx_global_movie_collection_id")
.withConsistentRead(false)
.withKeyConditionExpression("collectionId = :collectionId")
.withExpressionAttributeValues(parms);
PaginatedQueryList<Movie> queryList = dynamoDBTemplate.query(Movie.class, queryExpression);
From what I'm seeing, I'm thinking the GSI lookup will probably only have the attributes defined in the index, which I guess it not surprising. So probably need to set up GSI index with all attributes for easy use. But if that duplicates too much data, then it might be worthwhile to have an index with fewer attributes and just manually do additional lookups after the GSI lookup if more attributes are needed.
from spring-data-dynamodb.
Related Issues (20)
- Missing Local index projection settings
- Getting classnotfoundexception for class ReflectionEntityInformation HOT 3
- Getting NPE HOT 2
- project init error HOT 1
- Problem with findBy..Contains on a set HOT 3
- Hashmap Iteration Problem in thymeleaf
- AbstractDynamoDBEventListener throws assertion error
- using dynamic dynamodb's tablename, don't use find method for GSI. HOT 1
- This Spring Data DynamoDB implementation might not be compatible with the available Spring Data classes on the classpath HOT 5
- cdi-api dependency has a known vulnerability CVE-2014-8122
- TableNameResolver does not work with @DynamoDBIndexHashKey HOT 3
- IN operator and Order By falls back to Scan HOT 1
- @DynamoDBAutoGeneratedTimestamp(strategy=DynamoDBAutoGenerateStrategy.ALWAYS) is not working inside DynamoDBDocument
- Pagination not working properly returning random data.
- spring-data-dynamodb - Spring4Shell: Zero-Day Vulnerability in Spring Framework (CVE-2022-22965) HOT 2
- When 'findBy' method is annotated with @EnableScan or on class level, and the method uses only hash key (and range key), the method still executes scan instead of query. There is only a check if the used fields are GSI, but no checks if all the fields are hash/range keys. HOT 2
- How can I have dynamodb table name dynamically based on my env? HOT 1
- Same hash for multiple GSI, how to fetch data?
- AWS STS(security token service) support for DynamoDBMapper
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-dynamodb.