score:0

i think your query can be simplified a bit, to something like:

{
  "query": {
    "term": {
      "url": {
        "value": "http://example.com"
      }
    }
  }
}

weirdly, i would expect your query to return all documents, due to the nesting of your boolean queries. should means documents that match any query in the array are scored higher than those not matching. so, a should containing only one must should return all documents, with matching documents scored higher than non matching.

score:1

problem solved.

in the mapping, instead of doing:

client.execute {
  create index <my_index> mappings {
    <my_type> as {
      "url" typed stringtype analyzer notanalyzed
    }
  }
}

i should have done:

client.execute {
  create index <my_index> mappings {
    <my_type> as {
      "url" typed stringtype index "not_analyzed"
    }
  }
}

or

client.execute {
  create index <my_index> mappings {
    <my_type> as {
      "url" typed stringtype index notanalyzed
    }
  }
}

Related Query

More Query from same tag