I am using ES 7.10.2
I have fields with keyword and text mappings.
When user specifies the search string, I wanted to parse the pieces of search string, for each specific field, in the specific way that field mapping is configured, such that using same analyzer as provided in field mapping.
For this requirement I am using Query-String-Query, I validate the above statement using _validate query.
But the same is also seems to be true, regarding Multi_Match query.
See below example:
POST /testindex/_doc/1
{"id":1,"firstname":"john","middlename":"clark","lastname":"smith"}
POST /testindex/_doc/2
{"id":2,"firstname":"john","middlename":"paladini","lastname":"miranda"}
Now if I execute the validate queries.
GET testindex/_validate/query?pretty=true&explain=true
{
"query": {
"multi_match" : {
"operator" : "and",
"fields" : [
"firstname",
"lastname"
],
"query" : "john smith"
}
}
}
GET testindex/_validate/query?pretty=true&explain=true
{
"query": {
"query_string": {
"default_operator": "and",
"fields" : [
"firstname",
"lastname"
],
"query" : "john smith"
}
}
}
Result of both the queries are same:
{
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"valid" : true,
"explanations" : [
{
"index" : "testindex",
"valid" : true,
"explanation" : "((+firstname:john +firstname:smith) | (+lastname:john +lastname:smith))"
}
]
}
I know QSQ having capability of having special char of certain op
besides that what is the difference then for above requirement ? is there any diff when operator is "OR" ? or "AND" ?