Termvector with specific keywords from another index

Hi

I have an index with keywords associated to a category. My goal is to be able to use these keywords for _termvector.
For example

KEYWORD   | CATEGORY
---------------------
apple     | fruit
banana    | fruit
dog       | animal
cat       | animal
mouse     | animal

I'd like to only get term of _termvector using my KEYWORDS. Is that possible?

And even better if I could also have the category associated to a keyword in the _termvector response that would be fantastic. Like a sub aggregation. If not possible, I always send an new request to ES server, it's not a big deal.

Thanks

If I understand correctly what you are asking for is a feature called terms filtering. We have something like that in the dev version of ES, but it won't do what you'd like, until we add scripting. Right now it only filters terms based on their tf-idf scores. Concerning the sub-aggregation, I would think that you'd have to perform a new request each time. Hope this helps.