Skip to content

Commit

Permalink
Remove ignore_above parameter when indexing is disabled on field (e…
Browse files Browse the repository at this point in the history
…lastic#1483)

* remove ignore_above if indexing is disabled for a field

* update artifacts

* linting

* changelog

* update artifacts
  • Loading branch information
ebeahan committed Jun 29, 2021
1 parent 4508cd0 commit 96fd70d
Show file tree
Hide file tree
Showing 19 changed files with 15 additions and 39 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.next.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Thanks, you're awesome :-) -->

#### Bugfixes

* Remove `ignore_above` when `index: false` and `doc_values: false`. #1483

#### Added

* Support `match_only_text` data type in Go code generator. #1418
Expand Down
3 changes: 0 additions & 3 deletions experimental/generated/beats/fields.ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,6 @@
- name: original
level: core
type: keyword
ignore_above: 1024
description: 'Raw text message of entire event. Used to demonstrate log integrity or
where the full log message (before splitting it up in multiple parts) may
be required, e.g. for reindex.
Expand Down Expand Up @@ -3626,7 +3625,6 @@
- name: original
level: core
type: keyword
ignore_above: 1024
description: 'Deprecated for removal in next major version release. This field
is superseded by `event.original`.
Expand Down Expand Up @@ -8450,7 +8448,6 @@
- name: enrichments.event.original
level: core
type: keyword
ignore_above: 1024
description: 'Raw text message of entire event. Used to demonstrate log integrity or
where the full log message (before splitting it up in multiple parts) may
be required, e.g. for reindex.
Expand Down
3 changes: 0 additions & 3 deletions experimental/generated/ecs/ecs_flat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,6 @@ event.original:
example: Sep 19 08:26:10 host CEF:0|Security| threatmanager|1.0|100|
worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2spt=1232
flat_name: event.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down Expand Up @@ -5347,7 +5346,6 @@ log.original:
doc_values: false
example: Sep 19 08:26:10 localhost My log
flat_name: log.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down Expand Up @@ -12930,7 +12928,6 @@ threat.enrichments.event.original:
example: Sep 19 08:26:10 host CEF:0|Security| threatmanager|1.0|100|
worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2spt=1232
flat_name: threat.enrichments.event.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down
3 changes: 0 additions & 3 deletions experimental/generated/ecs/ecs_nested.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3433,7 +3433,6 @@ event:
example: Sep 19 08:26:10 host CEF:0|Security| threatmanager|1.0|100|
worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2spt=1232
flat_name: event.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down Expand Up @@ -6556,7 +6555,6 @@ log:
doc_values: false
example: Sep 19 08:26:10 localhost My log
flat_name: log.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down Expand Up @@ -14985,7 +14983,6 @@ threat:
example: Sep 19 08:26:10 host CEF:0|Security| threatmanager|1.0|100|
worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2spt=1232
flat_name: threat.enrichments.event.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down
3 changes: 0 additions & 3 deletions experimental/generated/elasticsearch/7/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down Expand Up @@ -1850,7 +1849,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down Expand Up @@ -4546,7 +4544,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down
1 change: 0 additions & 1 deletion experimental/generated/elasticsearch/component/event.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down
1 change: 0 additions & 1 deletion experimental/generated/elasticsearch/component/log.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down
1 change: 0 additions & 1 deletion experimental/generated/elasticsearch/component/threat.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down
4 changes: 0 additions & 4 deletions generated/beats/fields.ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,6 @@
- name: stack_trace
level: extended
type: keyword
ignore_above: 1024
multi_fields:
- name: text
type: text
Expand Down Expand Up @@ -1737,7 +1736,6 @@
- name: original
level: core
type: keyword
ignore_above: 1024
description: 'Raw text message of entire event. Used to demonstrate log integrity or
where the full log message (before splitting it up in multiple parts) may
be required, e.g. for reindex.
Expand Down Expand Up @@ -3247,7 +3245,6 @@
- name: original
level: core
type: keyword
ignore_above: 1024
description: 'Deprecated for removal in next major version release. This field
is superseded by `event.original`.
Expand Down Expand Up @@ -6122,7 +6119,6 @@
- name: enrichments.event.original
level: core
type: keyword
ignore_above: 1024
description: 'Raw text message of entire event. Used to demonstrate log integrity or
where the full log message (before splitting it up in multiple parts) may
be required, e.g. for reindex.
Expand Down
4 changes: 0 additions & 4 deletions generated/ecs/ecs_flat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1827,7 +1827,6 @@ error.stack_trace:
description: The stack trace of this error in plain text.
doc_values: false
flat_name: error.stack_trace
ignore_above: 1024
index: false
level: extended
multi_fields:
Expand Down Expand Up @@ -2306,7 +2305,6 @@ event.original:
example: Sep 19 08:26:10 host CEF:0|Security| threatmanager|1.0|100|
worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2spt=1232
flat_name: event.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down Expand Up @@ -4645,7 +4643,6 @@ log.original:
doc_values: false
example: Sep 19 08:26:10 localhost My log
flat_name: log.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down Expand Up @@ -9178,7 +9175,6 @@ threat.enrichments.event.original:
example: Sep 19 08:26:10 host CEF:0|Security| threatmanager|1.0|100|
worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2spt=1232
flat_name: threat.enrichments.event.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down
4 changes: 0 additions & 4 deletions generated/ecs/ecs_nested.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2579,7 +2579,6 @@ error:
description: The stack trace of this error in plain text.
doc_values: false
flat_name: error.stack_trace
ignore_above: 1024
index: false
level: extended
multi_fields:
Expand Down Expand Up @@ -3084,7 +3083,6 @@ event:
example: Sep 19 08:26:10 host CEF:0|Security| threatmanager|1.0|100|
worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2spt=1232
flat_name: event.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down Expand Up @@ -5854,7 +5852,6 @@ log:
doc_values: false
example: Sep 19 08:26:10 localhost My log
flat_name: log.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down Expand Up @@ -10868,7 +10865,6 @@ threat:
example: Sep 19 08:26:10 host CEF:0|Security| threatmanager|1.0|100|
worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2spt=1232
flat_name: threat.enrichments.event.original
ignore_above: 1024
index: false
level: core
name: original
Expand Down
4 changes: 0 additions & 4 deletions generated/elasticsearch/6/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,6 @@
"type": "text"
}
},
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down Expand Up @@ -794,7 +793,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down Expand Up @@ -1622,7 +1620,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down Expand Up @@ -3232,7 +3229,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down
4 changes: 0 additions & 4 deletions generated/elasticsearch/7/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,6 @@
"type": "text"
}
},
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down Expand Up @@ -790,7 +789,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down Expand Up @@ -1618,7 +1616,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down Expand Up @@ -3228,7 +3225,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down
1 change: 0 additions & 1 deletion generated/elasticsearch/component/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"type": "text"
}
},
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down
1 change: 0 additions & 1 deletion generated/elasticsearch/component/event.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down
1 change: 0 additions & 1 deletion generated/elasticsearch/component/log.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down
1 change: 0 additions & 1 deletion generated/elasticsearch/component/threat.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
},
"original": {
"doc_values": false,
"ignore_above": 1024,
"index": false,
"type": "keyword"
},
Expand Down
1 change: 1 addition & 0 deletions scripts/schema/cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def field_or_multi_field_datatype_defaults(field_details):
field_details.pop('index', None)
if 'index' in field_details and not field_details['index']:
field_details.setdefault('doc_values', False)
field_details.pop('ignore_above', None)


FIELD_MANDATORY_ATTRIBUTES = ['name', 'description', 'type', 'level']
Expand Down
12 changes: 12 additions & 0 deletions scripts/tests/unit/test_schema_cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ def test_field_defaults_dont_override(self):
cleaner.field_defaults({'field_details': field_details})
self.assertEqual(field_details['ignore_above'], 8000)

def test_field_defaults_index_false_doc_values_false(self):
field_details = {
'description': 'description',
'level': 'extended',
'name': 'my_non_indexed_field',
'type': 'keyword',
'index': False,
'doc_values': False
}
cleaner.field_defaults({'field_details': field_details})
self.assertNotIn("ignore_above", field_details)

def test_multi_field_defaults_and_precalc(self):
field_details = {
'description': 'description',
Expand Down

0 comments on commit 96fd70d

Please sign in to comment.