I have following document samples ->
{
“pGuid”: “12587740-7cb6-411e-9084-e87f770ddeef”,
“payoutAccounts”: [
{
“tenantCd”: “SAV”,
“account”: {
“instrumentTypeCd”: “PSA”,
“accountTokenTx”: “34562354531”,
“lastSnapshotTs”: “2020-07-18T20:07:56.209-07:00”
}
}
],
“schemaVersionNo”: “1”,
“reasonDs”: “good reason for create or update 3”,
“lastUpdatedTs”: “2020-08-26T20:07:56.209-07:00”,
“docVersionNo”: “2”,
“createdByNm”: “some batch id 3”,
“lastUpdatedByNm”: “update batch id 3”,
“type”: “wm.UsrAcc”,
“createdTs”: “2020-08-26T20:07:56.209-07:00”
}
OR
{
“createdByNm”: “some batch id 2”,
“createdTs”: “2020-08-26T20:07:12.797-07:00”,
“docVersionNo”: “1”,
“payoutAccounts”: [
{
“account”: {
“accountTokenTx”: “44be5684-e9cc-4fa3-a73a-3e177d70ff4e”,
“instrumentTypeCd”: “CRD”
},
“tenantCd”: “AWM”
}
],
“pGuid”: “017b6f57-bd92-4625-b87a-083426086204”,
“reasonDs”: “good reason for create or update 2”,
“schemaVersionNo”: “1”,
“type”: “wm.UsrAcc”
}
Not all users have a SAV tenancy.
I want to run a query that fetches batches of users who have a SAV tenancy and order by lastSnapshotTs, a batch is 500 users, say.
here is what I am trying and am not sure it is correct ->
SELECT * from BUCKET where type = ‘wm.UsrAcc’ and createdTs < ‘2020-09-01T00:00:00.000Z’ and ANY v IN payoutAccounts SATISFIES v.tenantCd = ‘SAV’ ORDER BY v. lastSnapshotTs END OFFSET 0 LIMIT 500
How will index creation be for above ?
thanks
rajans