Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fields country_name and region_iso_code to geo. #214

Merged
merged 3 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file based on the
* Reintroduce `http`. #237
* Add `user.full_name` field. #201
* Add `network.community_id` field. #208
* Add fields `geo.country_name` and `geo.region_iso_code`. #214

### Improvements
* Improved the definition of the file fields #196
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,13 @@ Note also that the `geo` fields are not expected to be used directly at the top

| Field | Description | Level | Type | Example |
|---|---|---|---|---|
| <a name="geo.continent_name"></a>geo.continent_name | Name of the continent. | core | keyword | `North America` |
| <a name="geo.country_iso_code"></a>geo.country_iso_code | Country ISO code. | core | keyword | `CA` |
| <a name="geo.location"></a>geo.location | Longitude and latitude. | core | geo_point | `{ "lon": -73.614830, "lat": 45.505918 }` |
| <a name="geo.continent_name"></a>geo.continent_name | Name of the continent. | core | keyword | `North America` |
| <a name="geo.country_name"></a>geo.country_name | Country name. | core | keyword | `Canada` |
| <a name="geo.region_name"></a>geo.region_name | Region name. | core | keyword | `Quebec` |
| <a name="geo.city_name"></a>geo.city_name | City name. | core | keyword | `Montreal` |
| <a name="geo.country_iso_code"></a>geo.country_iso_code | Country ISO code. | core | keyword | `CA` |
| <a name="geo.region_iso_code"></a>geo.region_iso_code | Region ISO code. | core | keyword | `CA-QC` |


## <a name="group"></a> Group fields
Expand Down
34 changes: 24 additions & 10 deletions fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -624,26 +624,26 @@
type: group
fields:

- name: location
level: core
type: geo_point
description: >
Longitude and latitude.
example: '{ "lon": -73.614830, "lat": 45.505918 }'

- name: continent_name
level: core
type: keyword
description: >
Name of the continent.
example: North America

- name: country_iso_code
- name: country_name
level: core
type: keyword
description: >
Country ISO code.
example: CA

- name: location
level: core
type: geo_point
description: >
Longitude and latitude.
example: '{ "lon": -73.614830, "lat": 45.505918 }'
Country name.
example: Canada

- name: region_name
level: core
Expand All @@ -659,6 +659,20 @@
City name.
example: Montreal

- name: country_iso_code
level: core
type: keyword
description: >
Country ISO code.
example: CA

- name: region_iso_code
level: core
type: keyword
description: >
Region ISO code.
example: CA-QC

- name: group
title: Group
group: 2
Expand Down
2 changes: 2 additions & 0 deletions schema.csv
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ file.uid,keyword,extended,
geo.city_name,keyword,core,Montreal
geo.continent_name,keyword,core,North America
geo.country_iso_code,keyword,core,CA
geo.country_name,keyword,core,Canada
geo.location,geo_point,core,"{ ""lon"": -73.614830, ""lat"": 45.505918 }"
geo.region_iso_code,keyword,core,CA-QC
geo.region_name,keyword,core,Quebec
group.id,keyword,extended,
group.name,keyword,extended,
Expand Down
34 changes: 24 additions & 10 deletions schemas/geo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
type: group
fields:

- name: location
level: core
type: geo_point
description: >
Longitude and latitude.
example: '{ "lon": -73.614830, "lat": 45.505918 }'

- name: continent_name
level: core
type: keyword
description: >
Name of the continent.
example: North America

- name: country_iso_code
- name: country_name
level: core
type: keyword
description: >
Country ISO code.
example: CA

- name: location
level: core
type: geo_point
description: >
Longitude and latitude.
example: '{ "lon": -73.614830, "lat": 45.505918 }'
Country name.
example: Canada

- name: region_name
level: core
Expand All @@ -49,3 +49,17 @@
description: >
City name.
example: Montreal

- name: country_iso_code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just call it country and have iso_code part of the description? Same below.

Main problem: Breaks with the generic geo processing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand what you mean by "Breaks with the generic geo processing". This is the field name as it is currently output by our geoip processor.

You're suggesting we use the canonical word ("country") for the field meant to contain the ISO code? If we were to use the canonical word for something, I'd rather it be the human name instead (country:Canada).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, what we have in here works. It just feels like the names are too long.

Let's move forward with it and figure it out later :-)

level: core
type: keyword
description: >
Country ISO code.
example: CA

- name: region_iso_code
level: core
type: keyword
description: >
Region ISO code.
example: CA-QC
8 changes: 8 additions & 0 deletions template.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,17 @@
"ignore_above": 1024,
"type": "keyword"
},
"country_name": {
"ignore_above": 1024,
"type": "keyword"
},
"location": {
"type": "geo_point"
},
"region_iso_code": {
"ignore_above": 1024,
"type": "keyword"
},
"region_name": {
"ignore_above": 1024,
"type": "keyword"
Expand Down