I am trying to search for the word "OR" in document from index.
Here is the query I type
GET index_name/_search
{
"query": {
"bool": {
"filter": [
{
"query_string": {
"query": "OR word1",
"fields": [
"field1"
]
}
}
]
}
}
}
I get the following Error
{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "Failed to parse query [OR word1]",
"index_uuid": "Brju2MNeQ5m7sI02Q2Y4gw",
"index": "index_name"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "index_name",
"node": "C5Suw-gaR7eehoH0WNGw1A",
"reason": {
"type": "query_shard_exception",
"reason": "Failed to parse query [OR word1]",
"index_uuid": "Brju2MNeQ5m7sI02Q2Y4gw",
"index": "index_name",
"caused_by": {
"type": "parse_exception",
"reason": "Cannot parse 'OR word1': Encountered \" <OR> \"OR \"\" at line 1, column 0.\nWas expecting one of:\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\" ...\n \"*\" ...\n <QUOTED> ...\n <TERM> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n <TERM> ...\n ",
"caused_by": {
"type": "parse_exception",
"reason": "Encountered \" <OR> \"OR \"\" at line 1, column 0.\nWas expecting one of:\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\" ...\n \"*\" ...\n <QUOTED> ...\n <TERM> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n <TERM> ...\n "
}
}
}
}
]
},
"status": 400
}
Why is this an error and whats the correct way to overcome this? If I remove the word "Or" from the query it works fine however when i keep it it give me this error