# Field names in Query String syntax doesn't filter this search

**URL:** <https://discuss.elastic.co/t/field-names-in-query-string-syntax-doesnt-filter-this-search/142419>\
**Category:** Elasticsearch\
**Created:** [July 31, 2018, 4:46pm UTC](https://discuss.elastic.co/t/field-names-in-query-string-syntax-doesnt-filter-this-search/142419 "2018-07-31T16:46:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohammedEssabri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohammedessabri/32/42177_2.png) [@mohammedEssabri](https://discuss.elastic.co/u/mohammedEssabri)\
**Post date:** [July 31, 2018, 4:46pm UTC](https://discuss.elastic.co/t/field-names-in-query-string-syntax-doesnt-filter-this-search/142419/1 "2018-07-31T16:46:42Z")

</div>

Dear Elasticsearch team,

I'm using Elasticsearch 1.7.  
Following this [link](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/query-dsl-query-string-query.html#query-string-syntax),  
The two following queries must give the same result, but it's not the case.

The first one gives expected result, but we created the second one to let search more convenient for user by letting him to write search by filters in one field ( which is faster then filling each field apart).  
But the second one doesn't use this filter at all.

**The first one:**

```
{
"query" : {
          "bool" : {
            "must" : [ {
              "query_string" : {
                "default_field" : "main_search_field_*"
              }
            }, {
              "bool" : {
                "must" : {
                  "query_string" : {
                    "query" : "PCT",
                    "fields" : ["TLE_*"]
                  }
                }
              }
            } ]
          }
        }
}

```

**The second one:**

```
{
 "bool" : {
     must" : [ {
         "query_string" : {
                "query" : "\"TLE_\\*:\"PCT\"\"",
                "default_field" : "main_search_field_*"
           }
     } ]
  }
}

```

Can some one help please?  
Thank you in advance.

---

<div class="post-metadata">

**Author:** ![mohammedEssabri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohammedessabri/32/42177_2.png) [@mohammedEssabri](https://discuss.elastic.co/u/mohammedEssabri)\
**Post date:** [August 1, 2018, 8:25am UTC](https://discuss.elastic.co/t/field-names-in-query-string-syntax-doesnt-filter-this-search/142419/2 "2018-08-01T08:25:55Z")

</div>

Dear all,

Can someone help me please?  
Thank you!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 1, 2018, 9:32am UTC](https://discuss.elastic.co/t/field-names-in-query-string-syntax-doesnt-filter-this-search/142419/3 "2018-08-01T09:32:40Z")

</div>

Read [this](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and specifically the "Also be patient" part.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 1, 2018, 9:34am UTC](https://discuss.elastic.co/t/field-names-in-query-string-syntax-doesnt-filter-this-search/142419/4 "2018-08-01T09:34:54Z")

</div>

Can you share a full reproduction script for 6.3 version?

That might have been fixed and anyway, as 1.7 is not maintained anymore, I don't think anyone will try to restart an old server like this to help.

So you will earn time by reproducing the problem on 6.3 IMHO.

---

<div class="post-metadata">

**Author:** ![mohammedEssabri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohammedessabri/32/42177_2.png) [@mohammedEssabri](https://discuss.elastic.co/u/mohammedEssabri)\
**Post date:** [August 1, 2018, 11:25am UTC](https://discuss.elastic.co/t/field-names-in-query-string-syntax-doesnt-filter-this-search/142419/5 "2018-08-01T11:25:49Z")

</div>

Dear @dadoonet,

Thank you for the advice!  
I'm sorry for that, I replied myself to let it visible as I'm pressed to find a solution.

Regarding your feedback about the problem, thank you for trying to help me,  
The problem was in query string which was surrounded by quotes **""TLE\_\*:"PCT"""** , that prevents Elasticsearch from interpreting it.

Thank you and best regards,

---

<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:** [August 29, 2018, 11:25am UTC](https://discuss.elastic.co/t/field-names-in-query-string-syntax-doesnt-filter-this-search/142419/6 "2018-08-29T11:25:52Z")

</div>

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