Fuzzy query


(lowang) #1

hi, maybe i'm missing something but I can't get it to work.
I've document like that:

curl -XPUT http://localhost:9200/lowang/ets/1 -d '
{
"_id":1,
"title":"smartfon nokia 5250"
}'

and fuzzy query like this runs fine:

curl -XGET http://localhost:9200/lowang/ets/_search -d '
{
"query" : {
"fuzzy" : { "title" : "smrt fon" }
}
}'
and I've got a hit.

however using following query which should be 100% match does not
return anything:

curl -XGET http://localhost:9200/lowang/ets/_search -d '
{
"query" : {
"fuzzy" : {
"title" : {
value: "smartfon nokia 5250"
}
}
}
}'

so please help, what am I doing wrong?


(lowang) #2

I've found that following query will do the trick:

curl -XGET http://localhost:9200/lowang/ets/_search -d '{
"query": {
"bool": {
"must":[
{ "fuzzy": { "title": { "value" : "smrtfon" } } },
{ "fuzzy": { "title": { "value" : "noia" } } }
]
}
}}'

On Jan 13, 11:58 pm, Przemyslaw Wroblewski
przemyslaw.wroblew...@gmail.com wrote:

hi, maybe i'm missing something but I can't get it to work.
I've document like that:

curl -XPUThttp://localhost:9200/lowang/ets/1-d '
{
"_id":1,
"title":"smartfon nokia 5250"

}'

and fuzzy query like this runs fine:

curl -XGEThttp://localhost:9200/lowang/ets/_search-d '
{
"query" : {
"fuzzy" : { "title" : "smrt fon" }
}}'

and I've got a hit.

however using following query which should be 100% match does not
return anything:

curl -XGEThttp://localhost:9200/lowang/ets/_search-d '
{
"query" : {
"fuzzy" : {
"title" : {
value: "smartfon nokia 5250"
}
}
}

}'

so please help, what am I doing wrong?


(system) #3