Hi,
I'm facing the following situation :
My data has a structure similar to this
{
"site1" : {
"events": [ {"event1", "date1"}, {"event1","date1-2"},{"event2","date3"}}]
...
},
"site2" : {
"events": [ {"event2", "date4"}, {"event1","date5"},{"event3","date6}}]
...
},
...
}
What I want is :
- Count the number of sites where a specific event occurs during a given time range.
- Count for each site the numer of occurences during a specific time range.
I could get the first via a simple count query. For the second my idea was to create a scripted field. For each document, the painless script iterates through the events, checks if the event is the one we are looking for and if the date is the right range then increments a counter.
The issue I am facing is that painless does not give me any way to access the fields of the events nested object.
Thank you for your help!
