hello,
I have an index called session_details, here is an example of a document:
{
"clientIdAsString" : "100",
"sessionStart" : "2021-12-14T17:14:49.000Z",
"user_id" : "0Bl301Me7x080r5o2K8m9D86Z",
"wz_session" : "r8820h69A2583A0uj01So1934",
"domainsGroup" : "wave-electronics.com",
"converted" : false,
"sessionEnd" : "2021-12-14T17:16:06.000Z",
"session_details" : [
{
"date_time" : "2021-12-14T17:15:11.000Z",
"type" : "goal",
"ok" : true,
"event_key" : "customer_login"
},
{
"error_message" : "error message xyz",
"date_time" : "2021-12-14T17:15:01.000Z",
"type" : "goal",
"ok" : false,
"event_key" : "customer_login"
},
{
"date_time" : "2021-12-14T17:15:11.000Z",
"ok" : true,
"event_key" : "add_to_cart"
}
]
}
here is the mappings:
{
"properties" : {
"clientIdAsString" : {
"type" : "keyword"
},
"converted" : {
"type" : "boolean"
},
"domainsGroup" : {
"type" : "keyword"
},
"sessionEnd" : {
"type" : "date"
},
"sessionStart" : {
"type" : "date"
},
"session_details" : {
"type" : "nested",
"properties" : {
"date_time" : {
"type" : "date"
},
"error_message" : {
"type" : "keyword"
},
"event_key" : {
"type" : "keyword"
},
"ok" : {
"type" : "boolean"
}
}
},
"user_id" : {
"type" : "keyword"
},
"wz_session" : {
"type" : "keyword"
}
}
}
the query that I'm trying to do is like this:
all the wz_session(s) - cardinality or value_count - it doesn't matters, where:
- session_details.event_key = 'customer_login' and,
- session_details.ok = true (only)
in other words, all the logins that succeeded and never failed.
in the above example, the result should be empty, since we have a failed and successful login.
is that possible ? if no is it possible with a different mappings ?
thanks