[SOLVED] aws dynamodb global secondary index cannot query existing items


This Content is from Stack Overflow. Question asked by Xiao Wang

id field1
1 guy

id as the primary key and field1 as the global secondary index:

    - AttributeName: id
      KeyType: HASH

    - IndexName: Field1Index
        - AttributeName: field1
          KeyType: HASH

when i use
dynamodb.get({TableName: 'myTable', Key: {id: 1}})
can find this record,
But when I use

        ExpressionAttributeNames: {
            '#field1': 'field1'
        ExpressionAttributeValues: {
            ":field1": field1
        KeyConditionExpression: "#field1 = :field1",
        IndexName: "Field1Index",})

At the time, early data can be found, but recent data cannot be found.

I don’t know if it has something to do with myTable’s data volume exceeding 8000, but I still have to say it in advance, and I have to add that the data of this table is always written into the data table through batch upload.

At present, what I suspect is that this data does not seem to be registered in the secondary index. There are 8,357 items in the data table and 7,599 items in the secondary index. Therefore, it can be determined that the missing items in the secondary index cannot be queried. data.

At the same time, I also tried to delete the problem data first, and then try to add it again
Problem still can’t be solved

Can anyone know what is the reason?


It looks like this, but there may be various warnings due to java version issues

This Question was asked in StackOverflow by Xiao Wang and Answered by Xiao Wang It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?