0
votes

I'm trying to query an Elasticsearch-wrapped Lucene index with edge ngrams in it, and cannot make sense of the documentation to figure out how to apply boolean operators to it. I have this:

{
  "query":{
  "bool":{
    "should":[
      {
        "match":{
          "name.partial":"+henry +james"
        }
      }
    ]
  }
}}

That doesn't work (I get results with henry and without james, and vice versa), and neither do \"henry james\", or henry AND james - I get the same things back no matter what. How do I get the behavior I want?

1

1 Answers

0
votes

You should use the query_string query for that. If you use the match query, I think the only thing that you can do is specify the query and the operator to use like this:

{
    "match" : {
        "message" : {
            "query" : "this is a test",
            "operator" : "and"
        }
    }
}