EdgenGram minimum length not working


(Clay Gorman) #1

Hello,

I am trying to do a terms aggregation on edgengrams that are longer then X in length but the results are coming back empty. If i remove the script filter results come back fine. Any suggestions?

POST /carrieradvancelog-*/_search
{
   "query": {
      "filtered": {
         "query": {
            "match_all": {}
         },
         "filter": {
            "script": {
               "script": "doc['dst_user.prefixes'].value.length() > param1",
               "params": {
                  "param1": 1
               }
            }
         }
      }
   },
   "size": 0,
   "aggs": {
      "badroutes": {
         "terms": {
            "field": "dst_user.prefixes",
            "size": 10
         }
      }
   }
}

(system) #2