# Searching terms in Inverted index

**URL:** https://discuss.elastic.co/t/searching-terms-in-inverted-index/257111
**Category:** Elasticsearch
**Created:** [November 30, 2020, 6:16pm UTC](https://discuss.elastic.co/t/searching-terms-in-inverted-index/257111 "2020-11-30T18:16:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![prasad.deshpande](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@prasad.deshpande](https://discuss.elastic.co/u/prasad.deshpande)
#### Post date: [November 30, 2020, 6:16pm UTC](https://discuss.elastic.co/t/searching-terms-in-inverted-index/257111/1 "2020-11-30T18:16:06Z")

</div>

Is there a way in Elasticsearch in which I can search all the terms in the inverted index? So say, if I want to find all the terms (Not the documents..) starting with `au` and ending with `o`.

I know that there is a `_termvector` API, but I need to specify a `document id` there and it doesn't allow me to search.

My use case is, I want to see how many terms are there in the inverted index matching a perticular REGEX pattern. I have also thought about using aggregation, but aggregation will be a heavy query to first search all docs and then compute terms aagregation on it...

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 28, 2020, 6:16pm UTC](https://discuss.elastic.co/t/searching-terms-in-inverted-index/257111/2 "2020-12-28T18:16:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
