Skip to content

Commit 50f000a

Browse files
Update doc
Signed-off-by: Andy Kwok <[email protected]>
1 parent 1a0e19f commit 50f000a

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

docs/category.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"user/ppl/functions/datetime.rst",
3535
"user/ppl/functions/expressions.rst",
3636
"user/ppl/functions/ip.rst",
37+
"user/ppl/functions/geoip.rst",
3738
"user/ppl/functions/math.rst",
3839
"user/ppl/functions/relevance.rst",
3940
"user/ppl/functions/string.rst"

docs/user/ppl/functions/geoip.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
====================
2+
Geo IP Address Functions
3+
====================
4+
5+
.. rubric:: Table of contents
6+
7+
.. contents::
8+
:local:
9+
:depth: 1
10+
11+
CIDRMATCH
12+
---------
13+
14+
Description
15+
>>>>>>>>>>>
16+
17+
Usage: `geoip(dataSourceName, ipAddress, options)` to lookup location information from given IP addresses via OpenSearch GeoSpatial plugin API.
18+
19+
Argument type: STRING, STRING, STRING
20+
21+
Return type: Tuple
22+
23+
Example:
24+
25+
os> source=weblogs | eval LookupResult = geoip("dataSourceName", "50.68.18.229", "country_iso_code,city_name")
26+
fetched rows / total rows = 1/1
27+
+-------------------------------------------------------------+
28+
| LookupResult |
29+
|-------------------------------------------------------------|
30+
| {'city_name': 'Vancouver', 'country_iso_code': 'CA'} |
31+
+-------------------------------------------------------------+
32+
33+
34+
Note:
35+
- `dataSourceName` must be an established dataSource on OpenSearch GeoSpatial plugin, detail of configuration can be found: https://opensearch.org/docs/latest/ingest-pipelines/processors/ip2geo/
36+
- `ip` can be an IPv4 or an IPv6 address
37+
- `options` is a comma separated String for user to specify fields to output, the selection of fields subject to dataSourceProvider's schema, the list of geolite2-city dataset provide fields: "country_iso_code", "country_name", "continent_name", "region_iso_code", "region_name", "city_name", "time_zone", "location"
38+

docs/user/ppl/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ The query start with search command and then flowing a set of command delimited
106106

107107
- `IP Address Functions <functions/ip.rst>`_
108108

109+
- `Geo IP Address Functions <functions/geoip.rst>`_
110+
109111
* **Optimization**
110112

111113
- `Optimization <../../user/optimization/optimization.rst>`_

0 commit comments

Comments
 (0)