# Simple query string with flags returns no results

**URL:** <https://discuss.elastic.co/t/simple-query-string-with-flags-returns-no-results/23444>\
**Category:** Elasticsearch\
**Created:** [April 28, 2015, 5:15pm UTC](https://discuss.elastic.co/t/simple-query-string-with-flags-returns-no-results/23444 "2015-04-28T17:15:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Nill](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel_nill/32/730_2.png) [@Daniel\_Nill](https://discuss.elastic.co/u/Daniel_Nill)\
**Post date:** [April 28, 2015, 5:15pm UTC](https://discuss.elastic.co/t/simple-query-string-with-flags-returns-no-results/23444/1 "2015-04-28T17:15:58Z")

</div>

curl -XPUT "[http://0.0.0.0:9200/users](http://0.0.0.0:9200/users)" -d '{  
"first\_name": "daniel",  
"last\_name": "nill"  
}'

curl -XGET '[http://0.0.0.0:9200/users/\_search](http://0.0.0.0:9200/users/_search)" -d '{  
"query": {  
"bool": {  
"must": {  
"simple\_query\_string": {

```
      "query":"daniel nill",
      "fields":[
        "lastname^6.5",
        "firstname^1.3",
      ],

      "default_operator":"and",
      "flags":"AND|OR|NOT|PHRASE|PRECEDENCE"
    }
  }
}

```

}  
}'

this returns no results

However,

curl -XGET '[http://0.0.0.0:9200/users/\_search](http://0.0.0.0:9200/users/_search)" -d '{  
"query": {  
"bool": {  
"must": {  
"simple\_query\_string": {

```
      "query":"daniel nill",
      "fields":[
        "lastname^6.5",
        "firstname^1.3",
      ],

      "default_operator":"and"
    }
  }
}

```

}  
}'

This returns results.

Any idea what I'm missing?

This is on 1.5.1

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/83d32c16-80b7-4428-904b-4d5bc9055be0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/83d32c16-80b7-4428-904b-4d5bc9055be0%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![roger](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@roger](https://discuss.elastic.co/u/roger)\
**Post date:** [April 28, 2015, 5:31pm UTC](https://discuss.elastic.co/t/simple-query-string-with-flags-returns-no-results/23444/2 "2015-04-28T17:31:49Z")

</div>

Are you actually using a comma after the "firstname^1.3"? It is invalid  
JSON in both cases

2015-04-28 14:15 GMT-03:00 Daniel Nill [daniellnill@gmail.com](mailto:daniellnill@gmail.com):

> curl -XPUT "[http://0.0.0.0:9200/users](http://0.0.0.0:9200/users)" -d '{  
> "first\_name": "daniel",  
> "last\_name": "nill"  
> }'
> 
> curl -XGET '[http://0.0.0.0:9200/users/\_search](http://0.0.0.0:9200/users/_search)" -d '{  
> "query": {  
> "bool": {  
> "must": {  
> "simple\_query\_string": {
> 
> ```
> "query":"daniel nill",
> "fields":[
> "lastname^6.5",
> "firstname^1.3",
> ],
> 
> "default_operator":"and",
> "flags":"AND|OR|NOT|PHRASE|PRECEDENCE"
> }
> }
> }
> 
> ```
> 
> }  
> }'
> 
> this returns no results
> 
> However,
> 
> curl -XGET '[http://0.0.0.0:9200/users/\_search](http://0.0.0.0:9200/users/_search)" -d '{  
> "query": {  
> "bool": {  
> "must": {  
> "simple\_query\_string": {
> 
> ```
> "query":"daniel nill",
> "fields":[
> "lastname^6.5",
> "firstname^1.3",
> ],
> 
> "default_operator":"and"
> }
> }
> }
> 
> ```
> 
> }  
> }'
> 
> This returns results.
> 
> Any idea what I'm missing?
> 
> This is on 1.5.1
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/83d32c16-80b7-4428-904b-4d5bc9055be0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/83d32c16-80b7-4428-904b-4d5bc9055be0%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/83d32c16-80b7-4428-904b-4d5bc9055be0%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/83d32c16-80b7-4428-904b-4d5bc9055be0%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAJp2533kQ4uQR%2B9fGhwKqDi2P\_cM-R6gNDcCheG098E2X\_DoiQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJp2533kQ4uQR%2B9fGhwKqDi2P_cM-R6gNDcCheG098E2X_DoiQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Daniel\_Nill](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel_nill/32/730_2.png) [@Daniel\_Nill](https://discuss.elastic.co/u/Daniel_Nill)\
**Post date:** [April 28, 2015, 5:53pm UTC](https://discuss.elastic.co/t/simple-query-string-with-flags-returns-no-results/23444/3 "2015-04-28T17:53:42Z")

</div>

I'm not. Sorry, copy and paste fail.

On Tuesday, April 28, 2015 at 10:31:58 AM UTC-7, Roger de Cordova Farias  
wrote:

> Are you actually using a comma after the "firstname^1.3"? It is invalid  
> JSON in both cases
> 
> 2015-04-28 14:15 GMT-03:00 Daniel Nill \<[danie...@gmail.com](mailto:danie...@gmail.com) \<javascript:\>\>:
> 
> > curl -XPUT "[http://0.0.0.0:9200/users](http://0.0.0.0:9200/users)" -d '{  
> > "first\_name": "daniel",  
> > "last\_name": "nill"  
> > }'
> > 
> > curl -XGET '[http://0.0.0.0:9200/users/\_search](http://0.0.0.0:9200/users/_search)" -d '{  
> > "query": {  
> > "bool": {  
> > "must": {  
> > "simple\_query\_string": {
> > 
> > ```
> > "query":"daniel nill",
> > "fields":[
> > "lastname^6.5",
> > "firstname^1.3",
> > ],
> > 
> > "default_operator":"and",
> > "flags":"AND|OR|NOT|PHRASE|PRECEDENCE"
> > }
> > }
> > }
> > 
> > ```
> > 
> > }  
> > }'
> > 
> > this returns no results
> > 
> > However,
> > 
> > curl -XGET '[http://0.0.0.0:9200/users/\_search](http://0.0.0.0:9200/users/_search)" -d '{  
> > "query": {  
> > "bool": {  
> > "must": {  
> > "simple\_query\_string": {
> > 
> > ```
> > "query":"daniel nill",
> > "fields":[
> > "lastname^6.5",
> > "firstname^1.3",
> > ],
> > 
> > "default_operator":"and"
> > }
> > }
> > }
> > 
> > ```
> > 
> > }  
> > }'
> > 
> > This returns results.
> > 
> > Any idea what I'm missing?
> > 
> > This is on 1.5.1
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/83d32c16-80b7-4428-904b-4d5bc9055be0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/83d32c16-80b7-4428-904b-4d5bc9055be0%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/83d32c16-80b7-4428-904b-4d5bc9055be0%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/83d32c16-80b7-4428-904b-4d5bc9055be0%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2e675e28-e586-444b-a969-ec6aa98cccfb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2e675e28-e586-444b-a969-ec6aa98cccfb%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:17am UTC](https://discuss.elastic.co/t/simple-query-string-with-flags-returns-no-results/23444/4 "2017-07-06T00:17:18Z")

</div>


