skip to Main Content

I am wondering how can I add the minimal_should_match parameter to SOLR Nested Boolean query?

I tried the next syntax, but it didn’t work:

{
  "query": {
    "bool": {
      "should": [
        {"edismax": {"df": "phones", "query": "111 222 333"}} 
         {"edismax": {"df": "phones2", "query": "111 222 333"}}
       ],
       "mm": 2
      }
    } 
}

I also tried to change the "mm" parameter to "minimal_should_match" like it works in Elastic, but it still doesn’t work.

Any thoughts? Should I implement this functionality by myself (query component or query parser) or I have a syntax error?

Thanks

2

Answers


  1. Replace your mm with minimum_should_match then recheck it if it works.

    I hope it helps!

    Login or Signup to reply.
  2. There are multiple issues in your query, like:

    • a missing comma at line 5
    • use of df instead of qf for edismax
    • use of mm outside of the edismax block.

    Proper syntax should be more like:

    {
      "query": {
        "bool": {
          "should": [
             {"edismax": {"qf": "phones" , "query": "111 222 333"}},
             {"edismax": {"qf": "phones2", "query": "111 222 333"}}
           ],
           "minimal_should_match": 2
          }
        } 
    }
    

    Also please report the exact errors from the parser, because "It does not work" does not help us helping you 😉

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search