Last active
April 14, 2021 17:10
-
-
Save djptek/06370bcfdb4b39921765cb108e1aad32 to your computer and use it in GitHub Desktop.
nested mapping within nested mapping for Elasticsearch
This file contains hidden or 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 nested_nested_test | |
{ | |
"mappings": { | |
"properties": { | |
"1": { | |
"type": "nested", | |
"properties": { | |
"2": { | |
"type": "nested", | |
"properties": { | |
"a": { | |
"type": "boolean" | |
}, | |
"b": { | |
"type": "boolean" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
PUT nested_nested_test/_doc/1 | |
{ | |
"1": [ | |
{ | |
"2": [ | |
{ | |
"a": true, | |
"b": false | |
} | |
] | |
} | |
] | |
} | |
# should get a hit | |
GET nested_nested_test/_search | |
{ | |
"query": { | |
"nested": { | |
"path": "1", | |
"query": { | |
"nested": { | |
"path": "1.2", | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"match": { | |
"1.2.a": true | |
} | |
}, | |
{ | |
"match": { | |
"1.2.b": false | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment