Issue on query string query for URL search

Hi,

I have pretty simple requirement to search the indexed data which has path (windows system path ) in it , but while searching I am getting 0 results. Can someone tell me whats I am doing wrong in this..

POST prashant/doc/1
{
  "id" : 1,
  "name" : "prashant",
  "Image" : "C:\\Windows\\splwow64.exe"
}

Now if I run POST prashant/_search , I can see the data but when I run the below query I get 0 results..

POST prashant/_search?pretty
{
  "query": {
    "query_string": {
      "default_field": "Image",
      "query": "C:\\Windows\\splwow64.exe"
    }
  }
}

Any idea what I am doing wrong here..

nvm got it working with this query ...

POST prashant/_search?pretty
{
  "query": {
    "query_string": {
      "default_field": "Image",
      "query": "\"C:\\\\Windows\\\\splwow64.exe\""
    }
  }
}

Sorry! JSON escaping combined with query_string escaping reminds me of shell script escaping in a bad way.

Yes but unfortunately no other way to get that working for this kind of search using query_string

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.