-1
Table : Customer

Item: CustomerId,PurchaseType,Name,mobilenumber,price, createdDate

DATA1: cus001,"online","BBBBB","yourmobilenumber",6000,"01/07/2017 01:12:05"
DATA2: cus002,"online","myname","mymobilenumber",500,"10/07/2017 01:12:01"
DATA3: cus003,"online","AAAAA","yourmobilenumber",6000,"10/07/2017 01:12:06"
DATA4: cus004,"online","yourname","yourmobilenumber",1000,"10/07/2017 02:12:06"
DATA5: cus005,"retail","yourname","yourmobilenumber",1000,"10/07/2017 03:12:06"

GSI: price-index[PurchaseType,price]

Query with index "price-index"

condition: purchasetype="online" and price >500

ScanIndex: true

How to get the result based on the following conditions:

purchasetype="online" price>500 order by Name

samson
  • 1,549
  • 3
  • 13
  • 20

1 Answers1

0

You need to create a different GSI:

PurchaseType - partition key of the GSI

Name - sort key of the GSI

Then you can use a query to find all items with the necessary purchase type, order by Name and provide a filter expression to filter all items with high prices.

Ivan Mushketyk
  • 8,107
  • 7
  • 50
  • 67