Created
September 25, 2015 16:20
-
-
Save anonymous/e74d11f8bc1e1309afa3 to your computer and use it in GitHub Desktop.
Queries and document
This file contains 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
Query with function score set to 'none' - returns the hit but scoring is reverse of what's desired: | |
{ | |
"size" : 100, | |
"query" : { | |
"function_score" : { | |
"filter" : { | |
"bool" : { | |
"must" : [ { | |
"geo_bbox" : { | |
"location" : { | |
"top_left" : [ -119.2, 34.3 ], | |
"bottom_right" : [ -119.0, 34.1 ] | |
} | |
} | |
}, { | |
"exists" : { | |
"field" : "visibilityDistanceSm" | |
} | |
} ] | |
} | |
}, | |
"functions" : [ { | |
"field_value_factor" : { | |
"field" : "visibilityDistanceSm", | |
"modifier" : "none" | |
} | |
} ] | |
} | |
} | |
} | |
Query with 'reciprocal', 'log', 'ln' and most other functions - does not return the document. | |
{ | |
"size" : 100, | |
"query" : { | |
"function_score" : { | |
"filter" : { | |
"bool" : { | |
"must" : [ { | |
"geo_bbox" : { | |
"location" : { | |
"top_left" : [ -119.2, 34.3 ], | |
"bottom_right" : [ -119.0, 34.1 ] | |
} | |
} | |
}, { | |
"exists" : { | |
"field" : "visibilityDistanceSm" | |
} | |
} ] | |
} | |
}, | |
"functions" : [ { | |
"field_value_factor" : { | |
"field" : "visibilityDistanceSm", | |
"modifier" : "reciprocal" | |
} | |
} ] | |
} | |
} | |
} | |
The document in question, note the value we are looking at is less than one (0.5): | |
{ | |
"id": "KNTD", | |
"text": "KNTD 251616Z 07006KT 1 1/2SM BR BKN003 22/20 A2990 RMK AO2 T02220200 $", | |
"temperatureC": 22, | |
"tempDewpointSpread": 2, | |
"pressureHg": 29.9, | |
"densityAltitudeFt": 1172, | |
"relativeHumidity": 88, | |
"visibilityUnrestricted": null, | |
"visibilityDistanceSm": 0.5, | |
"visibilityDistanceQualifier": null, | |
"windSpeedKts": 6, | |
"gustSpeedKts": null, | |
"windFrom": 70, | |
"windTo": null, | |
"windIsVariable": false, | |
"periodStart": null, | |
"periodEnd": null, | |
"flightRules": "LIFR", | |
"cloudLayers": [ | |
{ | |
"coverage": "bkn", | |
"type": null, | |
"altitudeFt": 300, | |
"ceiling": true, | |
"altitudeQualifier": null | |
} | |
], | |
"ceilingAltitudeFt": 300, | |
"ceilingCoverage": "BKN", | |
"totalRunwayLength": 16604, | |
"longestRunway": 11102, | |
"location": { | |
"lat": 34.119274471739864, | |
"lon": -119.11958509529566 | |
}, | |
"issuedDate": "2015-09-25T16:16:00.000Z", | |
"type": "WeatherConditionsMarker" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment