Repository: elastic/elasticsearch-dsl-py

Issue:
Add support for "ip_prefix" bucket aggregation
`elasticsearch_dsl/aggs.py` is missing "ip_prefix" bucket aggregation which is introduced in [v8.1.0](https://www.elastic.co/guide/en/elasticsearch/reference/8.1/release-notes-8.1.0.html#bug-8.1.0). [IP prefix aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-ipprefix-aggregation.html)

Discussion:

Patch:
diff --git a/elasticsearch_dsl/aggs.py b/elasticsearch_dsl/aggs.py
index 962cfc3..d9412e2 100644
--- a/elasticsearch_dsl/aggs.py
+++ b/elasticsearch_dsl/aggs.py
@@ -232,6 +232,10 @@ class IPRange(Bucket):
     name = "ip_range"
 
 
+class IPPrefix(Bucket):
+    name = "ip_prefix"
+
+
 class Missing(Bucket):
     name = "missing"
 


Test patch:
diff --git a/tests/test_aggs.py b/tests/test_aggs.py
index e908cc0..936c2bc 100644
--- a/tests/test_aggs.py
+++ b/tests/test_aggs.py
@@ -300,6 +300,30 @@ def test_variable_width_histogram_aggregation():
     assert {"variable_width_histogram": {"buckets": 2, "field": "price"}} == a.to_dict()
 
 
+def test_ip_prefix_aggregation():
+    a = aggs.IPPrefix(**{"field": "ipv4", "prefix_length": 24})
+
+    assert {"ip_prefix": {"field": "ipv4", "prefix_length": 24}} == a.to_dict()
+
+
+def test_ip_prefix_aggregation_extra():
+    a = aggs.IPPrefix(
+        **{
+            "field": "ipv6",
+            "prefix_length": 64,
+            "is_ipv6": True,
+        }
+    )
+
+    assert {
+        "ip_prefix": {
+            "field": "ipv6",
+            "prefix_length": 64,
+            "is_ipv6": True,
+        },
+    } == a.to_dict()
+
+
 def test_multi_terms_aggregation():
     a = aggs.MultiTerms(terms=[{"field": "tags"}, {"field": "author.row"}])
     assert {