As predicted, your IDF values differ. Shard 1 has fewer documents than
shard 4 with that term make the shard 1 documents more relevant. You can
change the search type as described above.
{
"value": 6.8087983,
"description": "idf(docFreq=86, maxDocs=28990)"
},
{
"value": 6.7636743,
"description": "idf(docFreq=90, maxDocs=28985)"
},
--
Ivan
On Tue, Oct 28, 2014 at 4:44 PM, Manuel Sciuto <[email protected]> wrote:
> Request
> GET /business/actividades,alojamiento,comida,transporte_&_servicios/_search
> {
> "explain": true,
> "query": {
> "filtered": {
> "query": {
> "match": {
> "name": "Sheraton"
> }
> }
> }
> }
> }
>
> Response
>
> {
> "took": 106,
> "timed_out": false,
> "_shards": {
> "total": 5,
> "successful": 5,
> "failed": 0
> },
> "hits": {
> "total": 506,
> "max_score": 6.8087983,
> "hits": [
> {
> "_shard": 1,
> "_node": "6MdK3cvjRQyqaaiUkxjIZQ",
> "_index": "business",
> "_type": "alojamiento",
> "_id": "273825",
> "_score": 6.8087983,
> "_source": {
> "name": "Sheraton",
> "reviews": 2
> },
> "_explanation": {
> "value": 6.8087983,
> "description": "weight(name:sheraton in 5198)
> [PerFieldSimilarity], result of:",
> "details": [
> {
> "value": 6.8087983,
> "description": "fieldWeight in 5198, product of:",
> "details": [
> {
> "value": 1,
> "description": "tf(freq=1.0), with freq of:",
> "details": [
> {
> "value": 1,
> "description": "termFreq=1.0"
> }
> ]
> },
> {
> "value": 6.8087983,
> "description": "idf(docFreq=86, maxDocs=28990)"
> },
> {
> "value": 1,
> "description": "fieldNorm(doc=5198)"
> }
> ]
> }
> ]
> }
> },
> {
> "_shard": 1,
> "_node": "6MdK3cvjRQyqaaiUkxjIZQ",
> "_index": "business",
> "_type": "alojamiento",
> "_id": "252355",
> "_score": 6.8087983,
> "_source": {
> "name": "Sheraton",
> "reviews": 1
> },
> "_explanation": {
> "value": 6.8087983,
> "description": "weight(name:sheraton in 19220)
> [PerFieldSimilarity], result of:",
> "details": [
> {
> "value": 6.8087983,
> "description": "fieldWeight in 19220, product of:",
> "details": [
> {
> "value": 1,
> "description": "tf(freq=1.0), with freq of:",
> "details": [
> {
> "value": 1,
> "description": "termFreq=1.0"
> }
> ]
> },
> {
> "value": 6.8087983,
> "description": "idf(docFreq=86, maxDocs=28990)"
> },
> {
> "value": 1,
> "description": "fieldNorm(doc=19220)"
> }
> ]
> }
> ]
> }
> },
> {
> "_shard": 1,
> "_node": "6MdK3cvjRQyqaaiUkxjIZQ",
> "_index": "business",
> "_type": "alojamiento",
> "_id": "132774",
> "_score": 6.8087983,
> "_source": {
> "name": "Sheraton",
> "reviews": 1
> },
> "_explanation": {
> "value": 6.8087983,
> "description": "weight(name:sheraton in 21640)
> [PerFieldSimilarity], result of:",
> "details": [
> {
> "value": 6.8087983,
> "description": "fieldWeight in 21640, product of:",
> "details": [
> {
> "value": 1,
> "description": "tf(freq=1.0), with freq of:",
> "details": [
> {
> "value": 1,
> "description": "termFreq=1.0"
> }
> ]
> },
> {
> "value": 6.8087983,
> "description": "idf(docFreq=86, maxDocs=28990)"
> },
> {
> "value": 1,
> "description": "fieldNorm(doc=21640)"
> }
> ]
> }
> ]
> }
> },
> {
> "_shard": 1,
> "_node": "6MdK3cvjRQyqaaiUkxjIZQ",
> "_index": "business",
> "_type": "alojamiento",
> "_id": "225509",
> "_score": 6.8087983,
> "_source": {
> "name": "Sheraton",
> "reviews": 2
> },
> "_explanation": {
> "value": 6.8087983,
> "description": "weight(name:sheraton in 22144)
> [PerFieldSimilarity], result of:",
> "details": [
> {
> "value": 6.8087983,
> "description": "fieldWeight in 22144, product of:",
> "details": [
> {
> "value": 1,
> "description": "tf(freq=1.0), with freq of:",
> "details": [
> {
> "value": 1,
> "description": "termFreq=1.0"
> }
> ]
> },
> {
> "value": 6.8087983,
> "description": "idf(docFreq=86, maxDocs=28990)"
> },
> {
> "value": 1,
> "description": "fieldNorm(doc=22144)"
> }
> ]
> }
> ]
> }
> },
> {
> "_shard": 1,
> "_node": "6MdK3cvjRQyqaaiUkxjIZQ",
> "_index": "business",
> "_type": "alojamiento",
> "_id": "232124",
> "_score": 6.8087983,
> "_source": {
> "name": "Sheraton",
> "reviews": 1
> },
> "_explanation": {
> "value": 6.8087983,
> "description": "weight(name:sheraton in 22498)
> [PerFieldSimilarity], result of:",
> "details": [
> {
> "value": 6.8087983,
> "description": "fieldWeight in 22498, product of:",
> "details": [
> {
> "value": 1,
> "description": "tf(freq=1.0), with freq of:",
> "details": [
> {
> "value": 1,
> "description": "termFreq=1.0"
> }
> ]
> },
> {
> "value": 6.8087983,
> "description": "idf(docFreq=86, maxDocs=28990)"
> },
> {
> "value": 1,
> "description": "fieldNorm(doc=22498)"
> }
> ]
> }
> ]
> }
> },
> {
> "_shard": 1,
> "_node": "6MdK3cvjRQyqaaiUkxjIZQ",
> "_index": "business",
> "_type": "alojamiento",
> "_id": "219172",
> "_score": 6.8087983,
> "_source": {
> "name": "Sheraton",
> "reviews": 0
> },
> "_explanation": {
> "value": 6.8087983,
> "description": "weight(name:sheraton in 1368)
> [PerFieldSimilarity], result of:",
> "details": [
> {
> "value": 6.8087983,
> "description": "fieldWeight in 1368, product of:",
> "details": [
> {
> "value": 1,
> "description": "tf(freq=1.0), with freq of:",
> "details": [
> {
> "value": 1,
> "description": "termFreq=1.0"
> }
> ]
> },
> {
> "value": 6.8087983,
> "description": "idf(docFreq=86, maxDocs=28990)"
> },
> {
> "value": 1,
> "description": "fieldNorm(doc=1368)"
> }
> ]
> }
> ]
> }
> },
> {
> "_shard": 4,
> "_node": "6MdK3cvjRQyqaaiUkxjIZQ",
> "_index": "business",
> "_type": "alojamiento",
> "_id": "224180",
> "_score": 6.7636743,
> "_source": {
> "name": "Sheraton",
> "reviews": 3
> },
> "_explanation": {
> "value": 6.7636743,
> "description": "weight(name:sheraton in 744)
> [PerFieldSimilarity], result of:",
> "details": [
> {
> "value": 6.7636743,
> "description": "fieldWeight in 744, product of:",
> "details": [
> {
> "value": 1,
> "description": "tf(freq=1.0), with freq of:",
> "details": [
> {
> "value": 1,
> "description": "termFreq=1.0"
> }
> ]
> },
> {
> "value": 6.7636743,
> "description": "idf(docFreq=90, maxDocs=28985)"
> },
> {
> "value": 1,
> "description": "fieldNorm(doc=744)"
> }
> ]
> }
> ]
> }
> },
> {
> "_shard": 4,
> "_node": "6MdK3cvjRQyqaaiUkxjIZQ",
> "_index": "business",
> "_type": "alojamiento",
> "_id": "268979",
> "_score": 6.7636743,
> "_source": {
> "name": "Sheraton",
> "reviews": 12
> },
> "_explanation": {
> "value": 6.7636743,
> "description": "weight(name:sheraton in 15584)
> [PerFieldSimilarity], result of:",
> "details": [
> {
> "value": 6.7636743,
> "description": "fieldWeight in 15584, product of:",
> "details": [
> {
> "value": 1,
> "description": "tf(freq=1.0), with freq of:",
> "details": [
> {
> "value": 1,
> "description": "termFreq=1.0"
> }
> ]
> },
> {
> "value": 6.7636743,
> "description": "idf(docFreq=90, maxDocs=28985)"
> },
> {
> "value": 1,
> "description": "fieldNorm(doc=15584)"
> }
> ]
> }
> ]
> }
> },
> {
> "_shard": 4,
> "_node": "6MdK3cvjRQyqaaiUkxjIZQ",
> "_index": "business",
> "_type": "alojamiento",
> "_id": "228353",
> "_score": 6.7636743,
> "_source": {
> "name": "Sheraton",
> "reviews": 2
> },
> "_explanation": {
> "value": 6.7636743,
> "description": "weight(name:sheraton in 22863)
> [PerFieldSimilarity], result of:",
> "details": [
> {
> "value": 6.7636743,
> "description": "fieldWeight in 22863, product of:",
> "details": [
> {
> "value": 1,
> "description": "tf(freq=1.0), with freq of:",
> "details": [
> {
> "value": 1,
> "description": "termFreq=1.0"
> }
> ]
> },
> {
> "value": 6.7636743,
> "description": "idf(docFreq=90, maxDocs=28985)"
> },
> {
> "value": 1,
> "description": "fieldNorm(doc=22863)"
> }
> ]
> }
> ]
> }
> },
> {
> "_shard": 4,
> "_node": "6MdK3cvjRQyqaaiUkxjIZQ",
> "_index": "business",
> "_type": "alojamiento",
> "_id": "112508",
> "_score": 6.7636743,
> "_source": {
> "name": "Sheraton",
> "reviews": 9
> },
> "_explanation": {
> "value": 6.7636743,
> "description": "weight(name:sheraton in 24214)
> [PerFieldSimilarity], result of:",
> "details": [
> {
> "value": 6.7636743,
> "description": "fieldWeight in 24214, product of:",
> "details": [
> {
> "value": 1,
> "description": "tf(freq=1.0), with freq of:",
> "details": [
> {
> "value": 1,
> "description": "termFreq=1.0"
> }
> ]
> },
> {
> "value": 6.7636743,
> "description": "idf(docFreq=90, maxDocs=28985)"
> },
> {
> "value": 1,
> "description": "fieldNorm(doc=24214)"
> }
> ]
> }
> ]
> }
> }
> ]
> }
> }
>
>
> El martes, 28 de octubre de 2014 16:47:56 UTC-3, Ivan Brusic escribió:
>>
>> The default scoring algorithm is based on TF-IDF.
>>
>> http://www.elasticsearch.org/guide/en/elasticsearch/guide/
>> current/practical-scoring-function.html
>> http://www.elasticsearch.org/guide/en/elasticsearch/guide/
>> current/scoring-theory.html
>>
>> You can enable explain to see how documents are scored:
>> http://www.elasticsearch.org/guide/en/elasticsearch/
>> reference/current/search-request-explain.html
>>
>> Without knowing more about your system, I suspect it is the IDF that is
>> causing the mismatch. The IDF is calculated per shard, so if when your
>> documents come from different shards, the scores can be different. Try
>> using a distributed search type (dfs_query_then_fetch) to see if the issue
>> still persists:
>> http://www.elasticsearch.org/guide/en/elasticsearch/guide/
>> current/_search_options.html#search-type
>>
>> Cheers,
>>
>> Ivan
>>
>> On Tue, Oct 28, 2014 at 3:38 PM, Manuel Sciuto <[email protected]>
>> wrote:
>>
>>> Hello
>>>
>>> How is score calculated?
>>>
>>> GET /business/actividades,alojamiento,comida,transporte_
>>> &_servicios/_search
>>> {
>>> "query": {
>>> "filtered": {
>>> "query": {
>>> "match": {
>>> "name": "Sheraton"
>>> }
>>> }
>>> }
>>> }
>>> }
>>>
>>> Response
>>>
>>> {
>>> "took": 4,
>>> "timed_out": false,
>>> "_shards": {
>>> "total": 5,
>>> "successful": 5,
>>> "failed": 0
>>> },
>>> "hits": {
>>> "total": 506,
>>> "max_score": 6.8087983,
>>> "hits": [
>>> {
>>> "_index": "business",
>>> "_type": "alojamiento",
>>> "_id": "273825",
>>> "_score": 6.8087983,
>>> "_source": {
>>> "name": "Sheraton",
>>> "reviews": 2
>>> }
>>> },
>>> {
>>> "_index": "business",
>>> "_type": "alojamiento",
>>> "_id": "252355",
>>> "_score": 6.8087983,
>>> "_source": {
>>> "name": "Sheraton",
>>> "reviews": 1
>>> }
>>> },
>>> {
>>> "_index": "business",
>>> "_type": "alojamiento",
>>> "_id": "132774",
>>> "_score": 6.8087983,
>>> "_source": {
>>> "name": "Sheraton",
>>> "reviews": 1
>>> }
>>> },
>>> {
>>> "_index": "business",
>>> "_type": "alojamiento",
>>> "_id": "225509",
>>> "_score": 6.8087983,
>>> "_source": {
>>> "name": "Sheraton",
>>> "reviews": 2
>>> }
>>> },
>>> {
>>> "_index": "business",
>>> "_type": "alojamiento",
>>> "_id": "232124",
>>> "_score": 6.8087983,
>>> "_source": {
>>> "name": "Sheraton",
>>> "reviews": 1
>>> }
>>> },
>>> {
>>> "_index": "business",
>>> "_type": "alojamiento",
>>> "_id": "219172",
>>> * "_score": 6.8087983,*
>>> "_source": {
>>> "name": "Sheraton",
>>> "reviews": 0
>>> }
>>> },
>>> {
>>> "_index": "business",
>>> "_type": "alojamiento",
>>> "_id": "224180",
>>> * "_score": 6.7636743,*
>>> "_source": {
>>> "name": "Sheraton",
>>> "reviews": 3
>>> }
>>> },
>>> {
>>> "_index": "business",
>>> "_type": "alojamiento",
>>> "_id": "268979",
>>> "_score": 6.7636743,
>>> "_source": {
>>> "name": "Sheraton",
>>> "reviews": 12
>>> }
>>> },
>>> {
>>> "_index": "business",
>>> "_type": "alojamiento",
>>> "_id": "228353",
>>> "_score": 6.7636743,
>>> "_source": {
>>> "name": "Sheraton",
>>> "reviews": 2
>>> }
>>> },
>>> {
>>> "_index": "business",
>>> "_type": "alojamiento",
>>> "_id": "112508",
>>> "_score": 6.7636743,
>>> "_source": {
>>> "name": "Sheraton",
>>> "reviews": 9
>>> }
>>> }
>>> ]
>>> }
>>> }
>>>
>>> Because the score is different in some cases? If the name is the same
>>>
>>> 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 [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/elasticsearch/bcaf4e31-f64a-4cc7-8b2f-986212216b9c%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/elasticsearch/bcaf4e31-f64a-4cc7-8b2f-986212216b9c%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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/7f9cd140-e096-4a49-811d-482f212243d4%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/7f9cd140-e096-4a49-811d-482f212243d4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CALY%3DcQArNDx9SWDYfxHiDQy_7t_gXQS9BkMHQTmuVp_FuwtueQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.