Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kkrik-es committed Dec 3, 2024
1 parent 4b5590c commit 73638b9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,8 @@ root with subobjects false and dynamic false:
subobjects: false
dynamic: false
properties:
id:
type: integer
my.keyword.field:
type: keyword

Expand All @@ -1201,7 +1203,7 @@ root with subobjects false and dynamic false:
refresh: true
body:
- '{ "index": { } }'
- '{ "my": { "keyword.field": "abc" } }'
- '{ "id": 1, "my": { "keyword.field": "abc" } }'
- match: { errors: false }

# indexing a dynamically-mapped field still fails (silently)
Expand All @@ -1211,17 +1213,18 @@ root with subobjects false and dynamic false:
refresh: true
body:
- '{ "index": { } }'
- '{ "my": { "random.field": "abc" } }'
- '{ "id": 2, "my": { "random.field": "abc" } }'
- match: { errors: false }

- do:
search:
index: test
body:
sort: id
fields: [ "*" ]

- match: { hits.hits.0.fields: { my.keyword.field: [ abc ] } }
- match: { hits.hits.1.fields: null }
- match: { hits.hits.0.fields: { my.keyword.field: [ abc ], id: [ 1 ] } }
- match: { hits.hits.1.fields: { id: [ 2 ] } }

- do:
search:
Expand Down Expand Up @@ -1249,6 +1252,8 @@ object with subobjects false and dynamic false:
subobjects: false
dynamic: false
properties:
id:
type: integer
nested.keyword.field:
type: keyword

Expand All @@ -1258,7 +1263,7 @@ object with subobjects false and dynamic false:
refresh: true
body:
- '{ "index": { } }'
- '{ "my": { "nested": { "keyword.field": "abc" } } }'
- '{ "id": 1, "my": { "nested": { "keyword.field": "abc" } } }'
- match: { errors: false }

# indexing a dynamically-mapped field still fails (silently)
Expand All @@ -1268,17 +1273,18 @@ object with subobjects false and dynamic false:
refresh: true
body:
- '{ "index": { } }'
- '{ "my": { "nested": { "random.field": "abc" } } }'
- '{ "id": 2, "my": { "nested": { "random.field": "abc" } } }'
- match: { errors: false }

- do:
search:
index: test
body:
sort: id
fields: [ "*" ]

- match: { hits.hits.0.fields: { my.nested.keyword.field: [ abc ] } }
- match: { hits.hits.1.fields: null }
- match: { hits.hits.0.fields: { my.nested.keyword.field: [ abc ], id: [ 1 ] } }
- match: { hits.hits.1.fields: { id: [ 2 ] } }

- do:
search:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2074,15 +2074,15 @@ public void testSubobjectsFalseWithInnerDottedObjectDynamicFalse() throws Except

doc = mapper.parse(source("""
{ "metrics": { "service": { "test.other.dots": "foo" } } }"""));
assertNull(doc.rootDoc().getField("metrics.service.test.with.dots"));
assertNull(doc.rootDoc().getField("metrics.service.test.other.dots"));

doc = mapper.parse(source("""
{ "metrics": { "service.test": { "other.dots": "foo" } } }"""));
assertNull(doc.rootDoc().getField("metrics.service.test.with.dots"));
assertNull(doc.rootDoc().getField("metrics.service.test.other.dots"));

doc = mapper.parse(source("""
{ "metrics": { "service": { "test": { "other.dots": "foo" } } } }"""));
assertNull(doc.rootDoc().getField("metrics.service.test.with.dots"));
assertNull(doc.rootDoc().getField("metrics.service.test.other.dots"));
}

public void testSubobjectsFalseRoot() throws Exception {
Expand Down Expand Up @@ -2126,15 +2126,15 @@ public void testSubobjectsFalseRootWithInnerDottedObjectDynamicFalse() throws Ex

doc = mapper.parse(source("""
{ "service": { "test.other.dots": "foo" } }"""));
assertNull(doc.rootDoc().getField("service.test.with.dots"));
assertNull(doc.rootDoc().getField("service.test.other.dots"));

doc = mapper.parse(source("""
{ "service.test": { "other.dots": "foo" } }"""));
assertNull(doc.rootDoc().getField("service.test.with.dots"));
assertNull(doc.rootDoc().getField("service.test.other.dots"));

doc = mapper.parse(source("""
{ "service": { "test": { "other.dots": "foo" } } }"""));
assertNull(doc.rootDoc().getField("service.test.with.dots"));
assertNull(doc.rootDoc().getField("service.test.other.dots"));
}

public void testSubobjectsFalseStructuredPath() throws Exception {
Expand Down

0 comments on commit 73638b9

Please sign in to comment.