Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elastic Search Query - Phrase with spaces

Hi I am trying to get a query to work and I am not understanding how to make it work

I want to search for all matching words like this

$term = +phrase +phrase +phrase

but if phrase has a space in it, how do i match phrase as a whole entity rather than it separating the words out into separate search items?

"query" : {
    "query_string" : {
        "query" : "' . $term . '"
    }
}
like image 774
Lawrence Cooke Avatar asked Oct 06 '22 00:10

Lawrence Cooke


1 Answers

Did you try something like +"this is my phrase" +"Another one" ?

Have a look also at Phrase Query (in Match Query doc) : http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html

like image 130
dadoonet Avatar answered Oct 13 '22 11:10

dadoonet