Hi,
In my scenario I am storing whole dynamoDB event into elastic search, now I want to get whole event by querying it.
Sharing below my index-document structure as well as my json query. What should be my json query to get matching hits on the basis of "CustomerId"
Kindly reply as soon as possible. Thanking you in anticipation. ...
{
"took": 19,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1111,
"max_score": 1,
"hits": [
{
"_index": "promotion_events",
"_type": "event",
"_id": "xxxxxxxxxxxx",
"_score": 1,
"_source": {
"eventId": "xxxxxxxxxx",
"record": {
"eventSourceARN": "arn:aws:dynamodb:xxxxxxxxxxxxxxxxxxxxx",
"eventID": "xxxxxxxxxxxxxxxx",
"eventName": "INSERT",
"eventVersion": "1.1",
"eventSource": "aws:dynamodb",
"awsRegion": "xxxxx",
"dynamodb": {
"keys": {
"id": { "s": "xxxxxxxxxxxxxxxxxxxxxx" } },
"newImage": {
"promotionType": { "s": "xxxxx" },
"enddate": { "s": "xxxxxx" },
"productid": { "s": "0" },
"campaignid": { "s": "xxxxxx" },
"**customerid**": { "s": "xxxxxxx" },
"id": { "s": "xxxxxxxxxxxxx" },
"promoid": { "s": "xxxxxxxxxxxxxxx" },
"source": { "s": "xxxxxxx" },
"startdate": { "s": "xxxxxxxxx" },
"storeid": { "s": "0" },
"barcodeid": { "s": "xxxxxxx" },
"timestamp": { "s": "xxxxxxxxxxxxxxx" }
},
"sequenceNumber": "xxxxxxxxxxxxxxxxx",
"sizeBytes": 9031,
"streamViewType": "NEW_AND_OLD_IMAGES"
}
}
}
}
]
}
}
My Json Query:
{
"_source": {
"include": ["record.*"]
},
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"term": {
"record.dynamodb.newImage.customerid": "xxxxxxx"
}
}
}
}
}
Output:
code : 200 , count :0
{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}