Query doesn't find results

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Query doesn't find results

Eugen Paraschiv
Hi,
I have the following document mapping:
{
   
"asset": {
       
"properties": {
           
"name": {
               
"analyzer": "keyword",
               
"store": true,
               
"type": "string"
           
},
           
"id": {
               
"index": "not_analyzed",
               
"type": "string"
           
}
       
}
   
}
}
Notice the keyword analyzer - the name will contain whitespace - and so I need it not to be tokenized but instead treated as a single token.

Here's a sample document (I removed some of the details for conciseness):
{
           
"_index": "local_defaultorg_asset",
           
"_type": "asset",
           
"_id": "jvMXDQYuSkqml3_QNfP_Gg",
           
"_score": 1,
           
"_source": {
               
"id": null,
               
"name": "yLYNQU ywYXzS",
           
}
}

Now, I'm running the following query (generated by Spring Data, so I don't have a lot of control over it):
{
 
"from": 0,
 
"query": {
   
"bool": {
     
"must": {
       
"query_string": {
         
"query": "yLYNQU ywYXzS",
         
"fields": [
           
"name"
         
]
       
}
     
}
   
}
 
}
}

But, unfortunately, I'm getting no results.
In a similar situation but without the whitespace, everything looks good and the query's able to find my document.
Am I missing anything on the mapping side?
Thanks,
Eugen.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9a8f9c9d-9227-42d2-aeae-4cdcf0236f08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Query doesn't find results

InquiringMind
I believe that the query_string has its own syntax that assumes tokenization and other preprocessing.

Maybe if you added name: to the query? But I am not sure how you would tell the query string that your phrase is really one token.

But, thanks for giving me one more reason to avoid Spring!

Brian

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4c6b4f8c-4600-435b-93f1-db62c807cf4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.