Searching for "SOMETHING" in "SOMEWHERE"

Here's a simplified example of what I'm trying to achieve - I am sure this is a pretty standard thing and I hope someone can point me in the right direction of a pattern, method, way to do this without re-inventing the wheel.

PUT /test/vendors/1
{
  "type": "clinic",
  "name": "ENT of Boston",
  "place": "Boston"  
}

PUT /test/vendors/2
{
  "type": "law firm",
  "name": "Ambulance Chasers Inc.",
  "place": "Boston"  

}

Say I want to support searches like these:

"Ambulance Chasers"
"Law Firm in Boston"

I can do a search like this:

GET /test/_search
{
  "query": {
    "multi_match" : {
      "query":    "Law Firm in Boston", 
      "fields": [ "type", "place", "name" ],
      "type": "most_fields"
    }
  }
}

the thing is, this would also get me ENT Of Boston because it has Boston in its name, although that's clearly not what I'm looking for.

I know I can write my own code to analyze the search string before it's submitted to Elasticsearch, and force Boston to be searched only in the place field in documents. I can do that to all fields and issue a super pin-pointer search query for EXACTLY what the user needs. But is there an easier way to handle something like that which I am missing?

I guess what I'm asking is whether there's a way Elasticseaarch can allow me to fine tune and "understand" what I'm looking for, without forcing me to dive deep into Natural Language Processing in my own code and re-invent the wheel.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.