Created
August 25, 2021 13:04
-
-
Save felixbarny/1f6ef39321849d7dd3889c5998e02a21 to your computer and use it in GitHub Desktop.
Flattened and runtime field test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT test | |
{ | |
"mappings": { | |
"dynamic": "runtime", | |
"properties": { | |
"service": { | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "keyword" | |
} | |
} | |
}, | |
"labels": { | |
"type": "flattened" | |
} | |
} | |
} | |
} | |
POST test/_doc | |
{ | |
"labels": { | |
"foo": "bar" | |
}, | |
"foo": "bar" | |
} | |
# no mapping conflicts | |
POST test/_doc | |
{ | |
"labels": { | |
"foo.bar": "baz" | |
}, | |
"foo": { | |
"bar": "baz" | |
} | |
} | |
# all searches return the expected results | |
POST test/_search?q=foo:bar | |
POST test/_search?q=foo.bar:baz | |
POST test/_search?q=labels.foo:bar | |
POST test/_search?q=labels.foo.bar:baz | |
POST test/_doc | |
{ | |
"service.name": "foo" | |
} | |
# fails with | |
# object mapping for [service] tried to parse field [service] as object, but found a concrete value | |
POST test/_doc | |
{ | |
"service": "foo" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment