Last active
August 29, 2015 13:56
-
-
Save luizgpsantos/9216108 to your computer and use it in GitHub Desktop.
Compute TF/IDF across indexes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPUT localhost:9200/index1/type/1 -d '{ | |
"title": "alice dance" | |
}' | |
curl -XPUT localhost:9200/index1/type/2 -d '{ | |
"title": "alice jump" | |
}' | |
curl -XPUT localhost:9200/index1/type/3 -d '{ | |
"title": "alice run" | |
}' | |
curl -XPUT localhost:9200/index2/type/1 -d '{ | |
"title": "alice walk" | |
}' | |
curl -XPUT localhost:9200/index2/type/2 -d '{ | |
"title": "marie jump" | |
}' | |
curl -XPUT localhost:9200/index2/type/3 -d '{ | |
"title": "leslie run" | |
}' | |
POST /index1,index2/_search | |
{ | |
"query": { | |
"query_string": { | |
"default_field": "title", | |
"query": "alice" | |
} | |
} | |
} | |
{"_index": "index2", "_type": "type", "_id": "1"} | |
{ | |
"_score": 0.8784157, | |
"_source": { | |
"title": "alice walks" | |
}, | |
"_explanation": { | |
"value": 0.8784157, | |
"description": "weight(title:alice in 0) [PerFieldSimilarity], result of:", | |
"details": [ | |
{ | |
"value": 0.8784157, | |
"description": "fieldWeight in 0, product of:", | |
"details": [ | |
{ | |
"value": 1, | |
"description": "tf(freq=1.0), with freq of:", | |
"details": [ | |
{ | |
"value": 1, | |
"description": "termFreq=1.0" | |
} | |
] | |
}, | |
{ | |
"value": 1.4054651, | |
"description": "idf(docFreq=1, maxDocs=3)" | |
}, | |
{ | |
"value": 0.625, | |
"description": "fieldNorm(doc=0)" | |
} | |
] | |
} | |
] | |
} | |
} | |
{"_index": "index1", "_type": "type", "_id": "1"} | |
{ | |
"_score": 0.4451987, | |
"_source": { | |
"title": "alice dances" | |
}, | |
"_explanation": { | |
"value": 0.4451987, | |
"description": "weight(title:alice in 0) [PerFieldSimilarity], result of:", | |
"details": [ | |
{ | |
"value": 0.4451987, | |
"description": "fieldWeight in 0, product of:", | |
"details": [ | |
{ | |
"value": 1, | |
"description": "tf(freq=1.0), with freq of:", | |
"details": [ | |
{ | |
"value": 1, | |
"description": "termFreq=1.0" | |
} | |
] | |
}, | |
{ | |
"value": 0.71231794, | |
"description": "idf(docFreq=3, maxDocs=3)" | |
}, | |
{ | |
"value": 0.625, | |
"description": "fieldNorm(doc=0)" | |
} | |
] | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment