# How to search across multiple types whose names start with a prefix?

**URL:** <https://discuss.elastic.co/t/how-to-search-across-multiple-types-whose-names-start-with-a-prefix/35600>\
**Category:** Elasticsearch\
**Created:** [November 25, 2015, 7:50pm UTC](https://discuss.elastic.co/t/how-to-search-across-multiple-types-whose-names-start-with-a-prefix/35600 "2015-11-25T19:50:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fritz](https://avatars.discourse-cdn.com/v4/letter/f/c57346/32.png) [@Fritz](https://discuss.elastic.co/u/Fritz)\
**Post date:** [November 25, 2015, 7:50pm UTC](https://discuss.elastic.co/t/how-to-search-across-multiple-types-whose-names-start-with-a-prefix/35600/1 "2015-11-25T19:50:01Z")

</div>

Hi folks

I've been looking in vain today for a way to search or filter documents across multiple types in an index by specifying those type names with a prefix or wildcard. Is this possible?

You can query in specific types supplied in the URL, you can build a filter query, but I couldn't find how to apply a prefix on the type.

Anything I missed?

Barring support from the API, the only solution I can imagine is to specify the type name as part of a document field such as the \_id and then apply a prefix query for that field, but it's rather arcane.

Thanks  
Fritz

---

<div class="post-metadata">

**Author:** ![Fritz](https://avatars.discourse-cdn.com/v4/letter/f/c57346/32.png) [@Fritz](https://discuss.elastic.co/u/Fritz)\
**Post date:** [November 25, 2015, 8:21pm UTC](https://discuss.elastic.co/t/how-to-search-across-multiple-types-whose-names-start-with-a-prefix/35600/2 "2015-11-25T20:21:15Z")

</div>

I eventually answered my own question, see below. I was trying to figure out how to apply a prefix to the "type filter" which spells the type as "type", whereas I could just issue a regular prefix query for the "\_type" field

"filter": {  
"prefix": {  
"\_type": "IndexTypePrefix"  
}  
}

---

<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:** [July 5, 2017, 11:35pm UTC](https://discuss.elastic.co/t/how-to-search-across-multiple-types-whose-names-start-with-a-prefix/35600/3 "2017-07-05T23:35:48Z")

</div>


