Specify field in Simple Query String


(Loïc Bertron) #1

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.
To view this discussion on the web visit 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.


(Binh Ly) #2

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.
To view this discussion on the web visit 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.


(system) #3