I guess if I bang at it hard enough.. I'll find a solution... this 
'Appears' to work... :)

{

   "min_score": 0,

   "query": {

      "function_score": {

         "boost_mode": "multiply",

         "functions": [

            {

               "script_score": {

                  "params": {

                     "min_value":0,

                     "max_value": 5

                  },

                  "script": "_score <= max_value && _score >= 
min_value?1:-1"

               }

            }

         ],

         "query": {

            "filtered": {

               "query": {

                  "has_child": {

                     "type": "service",

                     "score_type": "total",

                     "query": {

                        "match_all": {}

                     }

                  }

               },

               "filter": {

                  "and": [

                     {

                        "terms": {

                           "owk": [

                              23621

                           ]

                        }

                     },

                     {

                        "terms": {

                           "oowk": [

                              23621

                           ]

                        }

                     },

                     {

                        "term": {

                           "ismd": true

                        }

                     },

                     {

                        "and": [

                           {

                              "terms": {

                                 "owk": [

                                    23621

                                 ]

                              }

                           },

                           {

                              "terms": {

                                 "oowk": [

                                    23621

                                 ]

                              }

                           },

                           {

                              "term": {

                                 "ipl": false

                              }

                           },

                           {

                              "terms": {

                                 "pwk": [

                                    21754

                                 ]

                              }

                           },

                           {

                              "range": {

                                 "my": {

                                    "gte": 1980,

                                    "lte": 2015

                                 }

                              }

                           },

                           {

                              "term": {

                                 "isb": false

                              }

                           }

                        ]

                     }

                  ]

               }

            }

         }

      }

   },

   "from": 0,

   "size": 0,

   "aggs": {

      "unique": {

         "cardinality": {

            "field": "hhk",

            "precision_threshold": 40000

         }

      }

   }

}

On Wednesday, October 15, 2014 8:50:24 AM UTC-4, Darren McDaniel wrote:
>
> I've come up with something that will allow me to get the minimun level... 
> Now, do I need to do this at the client level to get the 'max' number... 
> say I want a range between 5 and 10... how do I limit the results to n 
> number of children? 
>
> {
>     "min_score": 5,
>     "query": {
>         "filtered": {
>             "query": {
>                 "has_child": {
>                     "type": "service",
>                     "score_type": "total",
>                     "query": {
>                         "match_all": {}
>                     }
>                 }
>             },
>             "filter": {
>                 "and": [
>                     {
>                         "terms": {
>                             "owk": [
>                                 23621
>                             ]
>                         }
>                     },
>                     {
>                         "terms": {
>                             "oowk": [
>                                 23621
>                             ]
>                         }
>                     },
>                     {
>                         "term": {
>                             "ismd": true
>                         }
>                     },
>                     {
>                         "and": [
>                             {
>                                 "terms": {
>                                     "owk": [
>                                         23621
>                                     ]
>                                 }
>                             },
>                             {
>                                 "terms": {
>                                     "oowk": [
>                                         23621
>                                     ]
>                                 }
>                             },
>                             {
>                                 "term": {
>                                     "ipl": false
>                                 }
>                             },
>                             {
>                                 "terms": {
>                                     "pwk": [
>                                         21754
>                                     ]
>                                 }
>                             },
>                             {
>                                 "range": {
>                                     "my": {
>                                         "gte": 1980,
>                                         "lte": 2015
>                                     }
>                                 }
>                             },
>                             {
>                                 "term": {
>                                     "isb": false
>                                 }
>                             }
>                         ]
>                     }
>                 ]
>             }
>         }
>     },
>     "from": 0,
>     "size": 0,
>     "aggs": {
>         "unique": {
>             "cardinality": {
>                 "field": "hhk",
>                 "precision_threshold": 40000
>             }
>         }
>     }
> }
>
>
>  
>

-- 
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/5a4c4564-a582-424b-aa8f-d59e9e1474ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to