Issue on query string query for URL search


(Prashant Agrawal) #1

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..


(Prashant Agrawal) #2

nvm got it working with this query ...

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

(Nik Everett) #3

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


(Prashant Agrawal) #4

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


(system) #5

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