Hi All, Starting to play with function_score and doc_values... I have a set of 30 documents with integers, ranging from 1 to 30.
Now I want a query that returns all documents with value 5 on top, followed by the rest of the documents, scored by their distance to 5. Query: "query": { "function_score": { "query": {"match_all": {}}, "boost_mode": "replace", "functions": [ { "gauss": { "int_field": { "origin": 5, "scale": 5, "offset": 2, "decay" : 0.1 }} } ] } } This returns the document with 5 with a score of 1 (expected), followed by the rest of the documents with a score 0 (NOT expected). Does someone see what I'm doing wrong? Looking at the explain, I see weird values for the doc_values. Following is the explain for the top document (with 5 as its value). Note the stated values for doc_value and origin! "_explanation": { "value": 1, "description": "function score, product of:", "details": [ { "value": 1, "description": "Math.min of", "details": [ { "value": 1, "description": "function score, score mode [multiply]", "details": [ { "value": 1, "description": "function score, product of:", "details": [ { "value": 1, "description": "match filter: *:*" }, { "value": 1, "description": "Function for field int_field:", "details": [ { "value": 1, "description": "exp(-0.5*pow(MIN of: [Math.max(Math.abs(-6.20093664E13(=doc value) - -6.20093664E13(=origin))) - 2.0(=offset), 0)],2.0)/5.428681023790649)" } ] } ] } ] }, { "value": 3.4028235e+38, "description": "maxBoost" } ] }, Best regards, Jan -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e2d438dd-26af-43df-b50d-21fca69121f6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.