How to get the total number of records that do not match a regex?

How to get the total number of records that do not match a regex? I'm doing this search:

{
	"query": {
		"bool": {
			"must_not": [
				{
					"regexp": {
						"clientip": {
							"value": "((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",
							"flags": "ALL",
							"rewrite": "constant_score"
						}
					}
				}
			]
		}
	}
}

This is an IP regex, however, the field in question may have integers that are not IP addresses. The query is not returning the total. How to achieve this value?

Current return:

{
  "took": 3,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 10000,
      "relation": "gte"
    },
    "max_score": null,
    "hits": []
  }
}

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