Maybe you can take a look at `ParentIdsFilter`? I added it for p/c because the regular Lucene TermsFilter is more a general purpose filter, you can filter across multiple fields etc. The `ParentIdsFilter` was just optimised for filtering  `_uid` field.