Skip to content

Commit

Permalink
[DOCS] URI parts processor (#65695) (#70353)
Browse files Browse the repository at this point in the history
  • Loading branch information
danhermann authored Mar 12, 2021
1 parent d3d5aea commit 3e20584
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/reference/ingest/ingest-node.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -905,4 +905,5 @@ include::processors/split.asciidoc[]
include::processors/trim.asciidoc[]
include::processors/uppercase.asciidoc[]
include::processors/url-decode.asciidoc[]
include::processors/uri-parts.asciidoc[]
include::processors/user-agent.asciidoc[]
82 changes: 82 additions & 0 deletions docs/reference/ingest/processors/uri-parts.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[role="xpack"]
[testenv="basic"]
[[uri-parts-processor]]
=== URI parts processor
++++
<titleabbrev>URI Parts</titleabbrev>
++++

Parses a Uniform Resource Identifier (URI) string and extracts its components as
an object. This URI object includes properties for the URI's domain, path, fragment,
port, query, scheme, user info, username, and password.

[[uri-parts-options]]
.URI Parts Options
[options="header"]
|======
| Name | Required | Default | Description
| `field` | yes | - | Field containing the URI string.
| `target_field` | no | `url` | Output field for the URI object.
| `keep_original` | no | true | If `true`, the processor copies the
unparsed URI to `<target_field>.original`.
| `remove_if_successful` | no | false | If `true`, the processor removes
the `field` after parsing the URI string. If parsing fails, the processor does not
remove the `field`.

include::common-options.asciidoc[]
|======

Here is an example definition of the URI parts processor:

[source,js]
--------------------------------------------------
{
"description" : "...",
"processors" : [
{
"uri_parts": {
"field": "input_field",
"target_field": "url",
"keep_original": true,
"remove_if_successful": false
}
}
]
}
--------------------------------------------------
// NOTCONSOLE

When the above processor executes on the following document:

[source,js]
--------------------------------------------------
{
"_source": {
"input_field": "http://myusername:mypassword@www.example.com:80/foo.gif?key1=val1&key2=val2#fragment"
}
}
--------------------------------------------------
// NOTCONSOLE

It produces this result:

[source,js]
--------------------------------------------------
"_source" : {
"input_field" : "http://myusername:mypassword@www.example.com:80/foo.gif?key1=val1&key2=val2#fragment",
"url" : {
"path" : "/foo.gif",
"fragment" : "fragment",
"extension" : "gif",
"password" : "mypassword",
"original" : "http://myusername:mypassword@www.example.com:80/foo.gif?key1=val1&key2=val2#fragment",
"scheme" : "http",
"port" : 80,
"user_info" : "myusername:mypassword",
"domain" : "www.example.com",
"query" : "key1=val1&key2=val2",
"username" : "myusername"
}
}
--------------------------------------------------
// NOTCONSOLE

0 comments on commit 3e20584

Please sign in to comment.