Slop distance

Slop distance

Hi,

I'm testing for my company a possible move from lucene to elasticsearch.

In lucene I have SetSlop, which when I set to 0 will bring results only for
the exact phrase.

In elastic search I use "phrase_slop": 0.0, but get results, when searching
for a part of a phrase.

I indexed "lazy red fox", searched for "lazy fox" and got results.

I searched using REST.

METHOD:

POST

URL:

http://localhost:9200/cinemagramcin/documents/_search

BODY:

{

"size": 500,

"query": {

"query_string": {

  "query": "fox lazy",

  "fields": [

    "board^5",

    "user^1",

    "description^10"

  ],

  "analyzer": "snowball",

  "phrase_slop": 0.0

}

},

"fields": [

"iDPin",

"iDPicture"

]

}

Thanks,

Ophir

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hey Ophir,

you used the "query_string" which is a query that is passed thorugh the
lucene query parser. if you specify "query" : "fox lazy" this gets
translated into a boolean query.
if you want to execute a phrase query you should rather use "query" :
""fox lazy"". Yet I'd recommend you using the match query instead which
is not passed through a query parser but still analyzed.

so this would look like: (slop is 0 by default)

{
"match" : {
"message" : {
"query" : "fox lazy",
"type" : "phrase"
}
}
}

for multiple fields support look at

hope this helps,

simon

On Sunday, February 17, 2013 12:28:30 PM UTC+1, Ophir Michaeli wrote:

Slop distance

Hi,

I'm testing for my company a possible move from lucene to elasticsearch.

In lucene I have SetSlop, which when I set to 0 will bring results only
for the exact phrase.

In Elasticsearch I use "phrase_slop": 0.0, but get results, when
searching for a part of a phrase.

I indexed "lazy red fox", searched for "lazy fox" and got results.

I searched using REST.

METHOD:

POST

URL:

http://localhost:9200/cinemagramcin/documents/_search

BODY:

{

"size": 500,

"query": {

"query_string": {

  "query": "fox lazy",

  "fields": [

    "board^5",

    "user^1",

    "description^10"

  ],

  "analyzer": "snowball",

  "phrase_slop": 0.0

}

},

"fields": [

"iDPin",

"iDPicture"

]

}

Thanks,

Ophir

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.