# Queries don't work as expected

**URL:** <https://discuss.elastic.co/t/queries-dont-work-as-expected/145734>\
**Category:** Elasticsearch\
**Created:** [August 23, 2018, 1:04pm UTC](https://discuss.elastic.co/t/queries-dont-work-as-expected/145734 "2018-08-23T13:04:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_Culina](https://avatars.discourse-cdn.com/v4/letter/i/848f3c/32.png) [@Ivan\_Culina](https://discuss.elastic.co/u/Ivan_Culina)\
**Post date:** [August 23, 2018, 1:04pm UTC](https://discuss.elastic.co/t/queries-dont-work-as-expected/145734/1 "2018-08-23T13:04:08Z")

</div>

I have a field named requestUri on Elastic server. It has values like "/api/v1/log/rest", "/api/v1/log/notification" etc.  
A user of the app I am working on should be able to filter those values. First, I tried to propagate the user's input as a simple match query but i get too many results because the default operator is OR. Then I changed the operator to AND and got expected results when had full words in query, but if a query contained only a part of a word I got nothing, e.g. /api/v1/log/re. Tried another queries (e.g. add stars to the user's input and tried wildcard query) but didn't have luck.

Can anyone help me to solve this? I don't think I can configure the index because it's automatically created by logstash every day.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [August 23, 2018, 3:53pm UTC](https://discuss.elastic.co/t/queries-dont-work-as-expected/145734/2 "2018-08-23T15:53:48Z")

</div>

Maybe use the path\_hierarchy tokenizer ([https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-pathhierarchy-tokenizer.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-pathhierarchy-tokenizer.html)) in your index analyzer and a simple keyword tokenizer in your search analyzer?

---

<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:** [September 20, 2018, 3:53pm UTC](https://discuss.elastic.co/t/queries-dont-work-as-expected/145734/3 "2018-09-20T15:53:48Z")

</div>

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