Can I use ip_range in composite source?

(Aaron Huang) #1

As title and I there's the code & result downbelow , thanks

Elastic version 6.7

Query

{
  "_source": ["timestamp"], 
"size":0,
  "query": {
    "constant_score": {
      "filter": {
        "bool":{
          "must":[
          {          
            "range": {
            "@timestamp": {
              "gte": 1553529600000,
              "lte": 1553615999999,
              "format": "epoch_millis"
          }
          
         }
          }
          ]
        }

      }
    }
  },"aggs": {
    "report": {
     "composite": {
       "size": 100, 
       "sources": [
        {
          "name":{"terms":{"field": "name.keyword"}}
        },
        {
          "ip_ranges" : {
              "ip_range": {
                "field": "ip",
                "ranges": [
                  {
                    "from": "10.0.0.5",
                    "to": "10.0.0.10"
                  }
                ]
              }
          }
        }

       ]
     }

    }
  }
}

Result

{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "invalid source type: ip_range",
        "line": 34,
        "col": 27
      }
    ],
    "type": "x_content_parse_exception",
    "reason": "[34:27] [composite] failed to parse field [sources]",
    "caused_by": {
      "type": "parsing_exception",
      "reason": "invalid source type: ip_range",
      "line": 34,
      "col": 27
    }
  },
  "status": 400
}
(system) closed #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.