# Query string query does not works if it ends with - , is this a bug or this is how it works

**URL:** <https://discuss.elastic.co/t/query-string-query-does-not-works-if-it-ends-with-is-this-a-bug-or-this-is-how-it-works/123124>\
**Category:** Elasticsearch\
**Created:** [March 8, 2018, 5:32pm UTC](https://discuss.elastic.co/t/query-string-query-does-not-works-if-it-ends-with-is-this-a-bug-or-this-is-how-it-works/123124 "2018-03-08T17:32:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prashant\_Agrawal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_agrawal/32/74982_2.png) [@Prashant\_Agrawal](https://discuss.elastic.co/u/Prashant_Agrawal)\
**Post date:** [March 8, 2018, 5:32pm UTC](https://discuss.elastic.co/t/query-string-query-does-not-works-if-it-ends-with-is-this-a-bug-or-this-is-how-it-works/123124/1 "2018-03-08T17:32:23Z")

</div>

Hello , I have seen an strange behavior with query string query , does anyone have any idea for same..  
Basically query string query does not works if search term ends with - , where as in between - works fine..

For Ex :

```auto
Does not works...
POST elastiflow-2018.03.07/_search
{
  "query": {
    "query_string": {
      "default_field": "event.type",
      "query": "ipfix -",
      "default_operator": "OR"
    }
  }
}

```

```auto
Works fine...
POST elastiflow-2018.03.07/_search
{
  "query": {
    "query_string": {
      "default_field": "event.type",
      "query": "ipfix -test - hello",
      "default_operator": "OR"
    }
  }
}

POST elastiflow-2018.03.07/_search
{
  "query": {
    "query_string": {
      "default_field": "event.type",
      "query": "ipfix - ",
      "default_operator": "OR"
    }
  }
}

```

---

<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:** [April 5, 2018, 5:32pm UTC](https://discuss.elastic.co/t/query-string-query-does-not-works-if-it-ends-with-is-this-a-bug-or-this-is-how-it-works/123124/2 "2018-04-05T17:32:40Z")

</div>

Closed on April 5, 2018, 5:32pm UTC

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