# Possible to query by token type?

**URL:** <https://discuss.elastic.co/t/possible-to-query-by-token-type/37597>\
**Category:** Elasticsearch\
**Created:** [December 18, 2015, 6:57pm UTC](https://discuss.elastic.co/t/possible-to-query-by-token-type/37597 "2015-12-18T18:57:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehowe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ehowe/32/6728_2.png) [@ehowe](https://discuss.elastic.co/u/ehowe)\
**Post date:** [December 18, 2015, 6:57pm UTC](https://discuss.elastic.co/t/possible-to-query-by-token-type/37597/1 "2015-12-18T18:57:19Z")

</div>

Suppose you use the UAX29URLEmailTokenizer for indexing a field. It generates tokens of type and in addition to and (and some others). Is there any way to, say, query for all documents that contain an token? Sure, I could use a regex query to find tokens that look like emails, but I want to only consider tokens.

---

<div class="post-metadata">

**Author:** ![ehowe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ehowe/32/6728_2.png) [@ehowe](https://discuss.elastic.co/u/ehowe)\
**Post date:** [December 18, 2015, 8:18pm UTC](https://discuss.elastic.co/t/possible-to-query-by-token-type/37597/2 "2015-12-18T20:18:58Z")

</div>

The only thing I've been able to find is a lucene question from ten years ago at [http://www.gossamer-threads.com/lists/lucene/java-user/14475](http://www.gossamer-threads.com/lists/lucene/java-user/14475). It basically indicates that only the terms are in the index, so assuming that hasn't changed, the answer to my question is "no." I've modified my tokenizer to prepend a special string to the terms, indicating the token type. It is then trivial to use a wildcard search on that special string.

---

<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:29pm UTC](https://discuss.elastic.co/t/possible-to-query-by-token-type/37597/3 "2017-07-05T23:29:53Z")

</div>


