I played around with this a little bit locally and I see what you're describing.  The problem seems to be that the         `{"range": {"form.visits": {"gte": 1, "lte": 4}}}` filter doesn't work as expected.  At first I thought maybe it's because those values are stored as strings, not numbers, but even a terms filter didn't match.  I'm not sure why it isn't working, but your script filter appears to do fine, so I'll just merge this.