Hi Mark,
GET cs180esacs18_export_pdmarticle_1/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"Label": "player"
}
}
],
"should": [
{
"match": {
"ExternalKey": "CS-77"
}
}
]
}
},
"_source": "false"
}
Gives following result
{
"took": 8,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 9,
"max_score": 8.017768,
"hits": [
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "10241",
"_score": 8.017768,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "77",
"_score": 7.8447104,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "10255",
"_score": 4.8923726,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "62",
"_score": 4.7425256,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "67",
"_score": 4.6269364,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "76",
"_score": 4.017816,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "79",
"_score": 3.5518925,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "78",
"_score": 3.4534197,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "81",
"_score": 3.382641,
"_source": {}
}
]
}
}
But constant_score query
GET cs180esacs18_export_pdmarticle_1/_search
{
"query": {
"constant_score": {
"filter": {
"bool": {
"must": [
{
"match": {
"Label": "player"
}
}
],
"should": [
{
"match": {
"ExternalKey": "CS-77"
}
}
]
}
},
"boost": 1.2
}
},
"_source": "false"
}
gives following result
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1.2,
"hits": [
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "10241",
"_score": 1.2,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "77",
"_score": 1.2,
"_source": {}
}
]
}
}
Btw post_filter query -
GET cs180esacs18_export_pdmarticle_1/_search
{
"post_filter": {
"bool": {
"must": [
{
"match": {
"Label": "player"
}
}
],
"should": [
{
"match": {
"ExternalKey": "CS-77"
}
}
]
}
},
"_source": "false"
}
Gives following result
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 9,
"max_score": 1,
"hits": [
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "79",
"_score": 1,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "10255",
"_score": 1,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "10241",
"_score": 1,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "78",
"_score": 1,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "62",
"_score": 1,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "81",
"_score": 1,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "77",
"_score": 1,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "67",
"_score": 1,
"_source": {}
},
{
"_index": "cs180esacs18_export_pdmarticle_1",
"_type": "item",
"_id": "76",
"_score": 1,
"_source": {}
}
]
}
}
So that's why i am using post_filter.
Have a look and suggest something.
Bye and thanks