This is messy. But ES supports a bunch of variations of things, so I think we have to do it this way or something like this.