Browse Source

[DOCS] Registered domain processor (#71753)

Dan Hermann 4 years ago
parent
commit
868ef7ef4a

+ 1 - 0
docs/reference/ingest/processors.asciidoc

@@ -58,6 +58,7 @@ include::processors/kv.asciidoc[]
 include::processors/lowercase.asciidoc[]
 include::processors/network-direction.asciidoc[]
 include::processors/pipeline.asciidoc[]
+include::processors/registered-domain.asciidoc[]
 include::processors/remove.asciidoc[]
 include::processors/rename.asciidoc[]
 include::processors/script.asciidoc[]

+ 82 - 0
docs/reference/ingest/processors/registered-domain.asciidoc

@@ -0,0 +1,82 @@
+[role="xpack"]
+[testenv="basic"]
+[[registered-domain-processor]]
+=== Registered domain processor
+++++
+<titleabbrev>Registered domain</titleabbrev>
+++++
+
+Extracts the registered domain (also known as the effective top-level domain or
+eTLD), sub-domain, and top-level domain from a fully qualified domain name
+(FQDN). Uses the registered domains defined in the
+https://publicsuffix.org/[Mozilla Public Suffix List].
+
+[[registered-domain-options]]
+.Registered Domain Options
+[options="header"]
+|======
+| Name               | Required | Default | Description
+| `field`            | yes      |         | Field containing the source FQDN.
+| `target_field`     | no       | `<empty string>` | Object field containing
+extracted domain components. If an `<empty string>`, the processor adds
+components to the document's root.
+| `ignore_missing`   | no       | `true`  | If `true` and any required fields
+are missing, the processor quietly exits without modifying the document.
+
+include::common-options.asciidoc[]
+|======
+
+[discrete]
+[[registered-domain-processor-ex]]
+===== Examples
+
+The following example illustrates the use of the registered domain processor:
+
+[source,console]
+----
+POST _ingest/pipeline/_simulate
+{
+  "pipeline": {
+    "processors": [
+      {
+        "registered_domain": {
+          "field": "fqdn",
+          "target_field": "url"
+        }
+      }
+    ]
+  },
+  "docs": [
+    {
+      "_source": {
+        "fqdn": "www.example.ac.uk"
+      }
+    }
+  ]
+}
+----
+
+Which produces the following result:
+
+[source,console-result]
+----
+{
+  "docs": [
+    {
+      "doc": {
+        ...
+        "_source": {
+          "fqdn": "www.example.ac.uk",
+          "url": {
+            "subdomain": "www",
+            "registered_domain": "example.ac.uk",
+            "top_level_domain": "ac.uk",
+            "domain": "www.example.ac.uk"
+          }
+        }
+      }
+    }
+  ]
+}
+----
+// TESTRESPONSE[s/\.\.\./"_index":"_index","_id":"_id","_ingest":{"timestamp":$body.docs.0.doc._ingest.timestamp},/]