# Specify field in Simple Query String

**URL:** <https://discuss.elastic.co/t/specify-field-in-simple-query-string/15959>\
**Category:** Elasticsearch\
**Created:** [February 21, 2014, 9:55pm UTC](https://discuss.elastic.co/t/specify-field-in-simple-query-string/15959 "2014-02-21T21:55:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Loic\_Bertron](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/loic_bertron/32/1794_2.png) [@Loic\_Bertron](https://discuss.elastic.co/u/Loic_Bertron)\
**Post date:** [February 21, 2014, 9:55pm UTC](https://discuss.elastic.co/t/specify-field-in-simple-query-string/15959/1 "2014-02-21T21:55:50Z")

</div>

Hello guys,

I wanna play with Simple Query String.

When i'm making a simple query with query\_string, i can specify the field  
in the query directly like that :

curl -XPOST localhost:9200/index/\_search -d '{

"query" : {

```
"query_string" : {

    "query" : "title:foo",

    "default_operator" : "and"

}

```

}}'

But when i'm using simple\_query\_string, the same query returns nothing.

curl -XPOST localhost:9200/index/\_search -d '{

"query" : {

```
"simple_query_string" : {

    "query" : "title:foo",

    "default_operator" : "and"

}

```

}}'

Any ideas ?

--  
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/85a2f30c-14d4-4edd-8333-e3e081c2db24%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/85a2f30c-14d4-4edd-8333-e3e081c2db24%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [February 21, 2014, 10:06pm UTC](https://discuss.elastic.co/t/specify-field-in-simple-query-string/15959/2 "2014-02-21T22:06:35Z")

</div>

For the simple\_query\_string, you can't embed fields directly into the  
query. But you can specify a fields value:

{  
"simple\_query\_string" : {  
"query": "foo",  
"fields": ["title"]  
}  
}

--  
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/d6a1dfb4-f9de-417c-9b3f-349ac4c28ce2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d6a1dfb4-f9de-417c-9b3f-349ac4c28ce2%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 1:48am UTC](https://discuss.elastic.co/t/specify-field-in-simple-query-string/15959/3 "2017-07-06T01:48:12Z")

</div>


