How do I get the estimate of the underlying matched query in a bool query in ElasticSearch?
I have a very complex search where I am essentially doing a large search for articles that match at least one object in a group of multiple objects.
What I noticed is that by adding more entities, the estimates change dramatically because my proposal should
grows in size.
Here is an example of my request with two objects:
{
"size": 50,
"track_scores": true,
"min_score": 0.05,
"sort": [
{
"timestamp": {
"order": "desc"
}
}
],
"query": {
"bool": {
"should": [
{
"bool": {
"should": [
{
"function_score": {
"functions": [
{
"boost_factor": 1000000
}
],
"query": {
"terms": {
"relatedProfiles": [
"SomethingElse/124026966662",
"SomeLocation/707765"
]
}
},
"boost_mode": "replace"
}
},
{
"bool": {
"should": [
{
"multi_match": {
"type": "phrase",
"query": "Generic Systems",
"operator": "and",
"fields": [
"content.title",
"content.description"
]
}
},
{
"multi_match": {
"type": "phrase",
"query": "Generic Systems, Inc.",
"operator": "and",
"fields": [
"content.title",
"content.description"
]
}
}
],
"minimum_should_match": "1"
}
}
],
"minimum_should_match": "1",
"_name": "0e7da739-1d18-448b-caa2-5c615a59d108"
}
},
{
"bool": {
"should": [
{
"function_score": {
"functions": [
{
"boost_factor": 1000000
}
],
"query": {
"terms": {
"relatedProfiles": [
"SomeLocation/162479",
"SomethingElse/32b95cc3-a363-47c3-2ac1-86fdb3b7d108"
]
}
},
"boost_mode": "replace"
}
},
{
"bool": {
"should": [
{
"multi_match": {
"type": "phrase",
"query": "SomeBusiness Computer Inc",
"operator": "and",
"fields": [
"content.title",
"content.description"
]
}
},
{
"multi_match": {
"type": "phrase",
"query": "SomeBusiness, Inc",
"operator": "and",
"fields": [
"content.title",
"content.description"
]
}
}
],
"minimum_should_match": "1"
}
}
],
"minimum_should_match": "1",
"_name": "00cc4b36-ce6b-4816-e61e-b7124344d108"
}
}
],
"minimum_should_match": "1"
}
},
"filter": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"bool": {
"must": [
{
"term": {
"type": "News"
}
},
{
"terms": {
"language": [
"eng"
]
}
}
]
}
},
{
"terms": {
"type": [
"Social",
"Job",
"Unknown"
]
}
}
]
}
},
{
"range": {
"timestamp": {
"lt": "2015-05-13T09:25:40.605",
"gt": "2013-05-13T09:25:40.605"
}
}
}
]
}
}
}
How can I get a base match? Or at least the section score below the name query?
source to share
Maybe https://elastic.co/webinars/elasticsearch-query-dsl has some ideas; later in the video he talks about the Dis Max request.
From https://www.elastic.co/guide/en/elasticsearch/reference/1.5/query-dsl-dis-max-query.html
“We want the primary score to be the one associated with the highest promotion, not the sum of the field scores (as a boolean query would).
source to share
You can use the explain API . When submitting a request, it gives you a lot of information on the compliance of the document about how this account was withdrawn. It is the perfect tool for debugging scores.
source to share