Querying with multiple local Secondary Index Dynamodb

Viewed 9672

I have 2 LSI in my table with a primary partition Key with primary sort key

Org-ID - primary partition Key

ClientID- primary sort Key

Gender - LSI

Section - LSI

I have no issue with querying a table with one LSI, but how to mention 2 LSI in a table schema.

 var params = {
 TableName:"MyTable",
 IndexNames: ['ClientID-Gender-index','ClientID-Section-index'], 

KeyConditionExpression : '#Key1 = :Value1 and #Key2=:Value2 and #Key3=:Value3', 

ExpressionAttributeNames:{
"#Key1":"Org-ID",
"#Key2":"Gender",
"#Key3":"Section"
},

ExpressionAttributeValues : {
':Value1' :"Microsoft",
':Value2':"Male",
':Value3':"Cloud Computing"
}};

Can anyone fix the issue in IndexName(line 3) or KeyConditionExpression(line 4), I'm not sure about it.

Issue

Condition can be of length 1 or 2 only

1 Answers
Related