Skip to content

Fix ignore_malformed behaviour for unsigned long fields #110045

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

Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3efacc8
fix: parsing objects for unsigned long fields
salvatore-campagna Jun 21, 2024
3b555ab
fix: remove duplicate match_all query
salvatore-campagna Jun 21, 2024
a2d7efb
Update docs/changelog/110045.yaml
salvatore-campagna Jun 21, 2024
aac3aa8
dry: extract method
salvatore-campagna Jun 21, 2024
e6cf588
nit: error message
salvatore-campagna Jun 21, 2024
96c49e4
fix: use isValue
salvatore-campagna Jun 21, 2024
f21bce8
test: add a few more malformed tests
salvatore-campagna Jun 21, 2024
d515a8c
test: check no ignored field
salvatore-campagna Jun 21, 2024
212ce37
fix: hits array idnex
salvatore-campagna Jun 21, 2024
9b56f72
fix: _ignored null check instead of length
salvatore-campagna Jun 21, 2024
12865e6
Merge branch 'main' into fix/109705-unsigned-long-ignore-malformed
salvatore-campagna Jun 22, 2024
7df4159
fix: compiler error after conflict resolution
salvatore-campagna Jun 22, 2024
30bc13a
fix: keep existing failure behavior if not malformed or not stored so…
salvatore-campagna Jun 22, 2024
b306187
test: synthetic source and stored source
salvatore-campagna Jun 22, 2024
2d0fda2
fix: assign parsing result
salvatore-campagna Jun 24, 2024
f4009f5
fix: catch merge object with non-object
salvatore-campagna Jun 24, 2024
e31c841
fix: error handling while parsing unsigned longs
salvatore-campagna Jun 25, 2024
15669d3
fix: uncomment different exception
salvatore-campagna Jun 25, 2024
17cad30
fix: index and error
salvatore-campagna Jun 26, 2024
cecca7b
fix: ignore_malformed for unsigned long
salvatore-campagna Jun 27, 2024
4a411f7
fix: changelog summary
salvatore-campagna Jun 27, 2024
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
Prev Previous commit
Next Next commit
test: synthetic source and stored source
  • Loading branch information
salvatore-campagna committed Jun 22, 2024
commit b3061870aac3d06e501e8aaa0b8825d288efb26d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"unsigned_long with ignore_malformed in synthetic source":
- do:
indices.create:
index: test
index: test-synthetic
body:
mappings:
_source:
Expand All @@ -19,7 +19,7 @@
catch: bad_request
index:
refresh: true
index: test
index: test-synthetic
id: "1"
body: { "ul_ignored": 2000, "ul_not_ignored": { "key": "bar", value: 200 } }

Expand All @@ -28,41 +28,41 @@
- do:
index:
refresh: true
index: test
index: test-synthetic
id: "2"
body: { "ul_ignored": { "key": "foo", "value": 100 }, "ul_not_ignored": 1000 }

- do:
index:
refresh: true
index: test
index: test-synthetic
id: "3"
body: { "ul_ignored": [ 100, 200, 300 ], "ul_not_ignored": 3000 }

- do:
index:
refresh: true
index: test
index: test-synthetic
id: "4"
body: { "ul_ignored": [ { "key": "a", "value": 100 }, { "key": "b", "value": 200 } ], "ul_not_ignored": 4000 }

- do:
index:
refresh: true
index: test
index: test-synthetic
id: "5"
body: { "ul_ignored": [1, 2, 3], "ul_not_ignored": 4000 }

- do:
index:
refresh: true
index: test
index: test-synthetic
id: "6"
body: { "ul_ignored": [ 1, "foo", 3, "bar" ], "ul_not_ignored": 4000 }

- do:
search:
index: test
index: test-synthetic
body:
query:
match_all: { }
Expand Down Expand Up @@ -100,3 +100,80 @@
- match: { hits.hits.4._source.ul_not_ignored: 4000 }
- length: { hits.hits.4._ignored: 1 }
- match: { hits.hits.4._ignored.0: "ul_ignored" }

---
"unsigned_long with ignore_malformed with stored source":
- do:
indices.create:
index: test-stored
body:
mappings:
_source:
mode: stored
properties:
ul_ignored:
type: unsigned_long
ignore_malformed: true
ul_not_ignored:
type: unsigned_long
ignore_malformed: false

- do:
catch: bad_request
index:
refresh: true
index: test-stored
id: "1"
body: { "ul_ignored": 2000, "ul_not_ignored": { "key": "bar", value: 200 } }

- match: { error.root_cause.0.type: "document_parsing_exception" }

- do:
catch: bad_request
index:
refresh: true
index: test-stored
id: "2"
body: { "ul_ignored": { "key": "foo", "value": 100 }, "ul_not_ignored": 1000 }

- do:
index:
refresh: true
index: test
id: "3"
body: { "ul_ignored": [ 100, 200, 300 ], "ul_not_ignored": 3000 }

- do:
catch: bad_request
index:
refresh: true
index: test-stored
id: "4"
body: { "ul_ignored": [ { "key": "a", "value": 100 }, { "key": "b", "value": 200 } ], "ul_not_ignored": 4000 }

- do:
index:
refresh: true
index: test-stored
id: "5"
body: { "ul_ignored": [1, 2, 3], "ul_not_ignored": 4000 }

- do:
index:
refresh: true
index: test-stored
id: "6"
body: { "ul_ignored": [ 1, "foo", 3, "bar" ], "ul_not_ignored": 4000 }

- do:
search:
index: test
body:
query:
match_all: { }

- match: { hits.total.value: 1 }

- match: { hits.hits.0._source.ul_ignored: [ 100, 200, 300 ] }
- match: { hits.hits.0._source.ul_not_ignored: 3000 }
- match: { hits.hits.0._ignored: null }