I am confused about the way boosting works inside a dis_max query.

I have documents to search with two fields - "name" and "important". 
Anything that matches within "important" must come before anything in 
"name". The query I have is a dis_max of:

  "match": { "name": { "query": "zzz", "fuzziness": "AUTO" }}
  "match": { "important": { "query": "zzz", "fuzziness": "AUTO", "boost": 
100 }}

The two test documents are: { "name": "zzz" } and { "important": "zzz" }.

They are scored *the same* on the above dis_max, and the explanation 
doesn't mention the boost at all.

However, if I remove fuzziness from the "important" query:

  "match": { "important": { "query": "zzz", "boost": 100 }}

Then the "important" document scores better, as it (in my intent) should.

How does boosting work inside a dis_max query?

How do I correctly boost the "important" field inside a dis_max?

Attached is the cURL reproduction of the problem.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/4ce0807c-b9f3-48d7-84e8-f664c7de4552%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#!/bin/sh -e

curl -s -XDELETE 'http://localhost:9200/testidx' || true
curl -XPOST 'http://localhost:9200/testidx/doctype/1' -d '{"name": "zzz"}'
curl -XPOST 'http://localhost:9200/testidx/doctype/2' -d '{"important": "zzz"}'
curl -XPOST 'http://localhost:9200/testidx/_refresh'

curl -XPOST 'http://localhost:9200/testidx/doctype/_search?pretty&explain' -d '{
  "query": {
    "dis_max": {
      "queries": [
        {
          "match": {
            "name": {
              "query": "zzz",
              "fuzziness": "AUTO"
            }
          }
        },
        {
          "match": {
            "important": {
              "query": "zzz",
              "boost": 100
            }
          }
        }
      ]
    }
  }
}'

curl -XPOST 'http://localhost:9200/testidx/doctype/_search?pretty&explain' -d '{
  "query": {
    "dis_max": {
      "queries": [
        {
          "match": {
            "name": {
              "query": "zzz",
              "fuzziness": "AUTO"
            }
          }
        },
        {
          "match": {
            "important": {
              "query": "zzz",
              "fuzziness": "AUTO",
              "boost": 100
            }
          }
        }
      ]
    }
  }
}'

Reply via email to