Hi All,
I have a following query, which I need to understand, How the scoring
calculations are taking place here
the query is :
{
"query": {
"custom_filters_score": {
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"has_child": {
"type": "child_GeoCountry",
"score_type": "sum",
"query": {
"constant_score": {
"query": {
"term": {
"rel": "rating_fan"
}
}
}
}
}
},
{
"has_child": {
"type": "child_GeoState",
"score_type": "sum",
"query": {
"constant_score": {
"query": {
"term": {
"rel": "rating_fan"
}
}
}
}
}
},
{
"has_child": {
"type": "child_GeoWorld",
"score_type": "sum",
"query": {
"constant_score": {
"query": {
"term": {
"rel": "rating_fan"
}
}
}
}
}
},
{
"has_child": {
"type": "child_GeoCity",
"score_type": "sum",
"query": {
"constant_score": {
"query": {
"term": {
"rel": "rating_fan"
}
}
}
}
}
},
{
"has_child": {
"type": "child_GeoNeighborhood",
"score_type": "sum",
"query": {
"constant_score": {
"query": {
"term": {
"rel": "rating_fan"
}
}
}
}
}
}
]
}
},
"filter": {
"or": [
{
"term":{
"geo_guid" : 23456
}
},
{
"term":{
"user_guid" : 87688
}
}
]
}
}
}
]
}
}
},
"filters": [
{
"filter": {
"term": {
"subtype": "GeoNeighborhood"
}
},
"script": 1000
},
{
"filter": {
"term": {
"subtype": "GeoCity"
}
},
"script": 2000
},
{
"filter": {
"term": {
"subtype": "GeoState"
}
},
"script": 3000
},
{
"filter": {
"term": {
"subtype": "GeoCountry"
}
},
"script": 4000
}
],
"score_mode": "total"
}
},
"sort": {
"_score": {
"order": "desc"
}
},
"size": 10
}
Now what this query was designed for is to find all of the documents having
given "geo_guid" or user_guid, but they should be sorted by the number of
child each document have. I have multiple child types, so I used should
clause. i but the sorting's priority should be, the country entities
should be listed first, they should be sorted by number of child doc they
have, then states entities should come, and within the single bunch all
states should be sorted by number of child doc they have and so on.. This
was my requirement. But when I created the above query, the results are
messed. Country, states and cities all are showing mixed.
I wanted to have the following output
country1 -- 10 children
country2 -- 7 children
country3 -- 3 children
state1 -- 15 children
state2 -- 10 children
state 3 -- 8 children
city1 -- 6 children
city2 -- 2 children
city3 -- 0 child
etc.
So I need to understand, what section is calculating first scoring, which
comes after, and How the total score is being aggregated, and How I can
change the behave as It seems to me like the first score is being
multiplied internally to other to give total score, and I do not want this.
Thanks
--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ba77823e-784a-41f3-98f7-d2ed8ca569fc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.