mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[DOCS] Adds content on nested queries (#146829)
## Summary This PR adds content on nested queries. Preview: [https://kibana_146829.docs-preview.app.elstc.co/guide/en/kibana/master/kuery-query.html](https://kibana_146829.docs-preview.app.elstc.co/guide/en/kibana/master/kuery-query.html)
This commit is contained in:
parent
ec7ba49dca
commit
f95414f76f
1 changed files with 62 additions and 0 deletions
|
@ -184,3 +184,65 @@ documents where any sub-field of `http.response` contains “error”, use the f
|
|||
-------------------
|
||||
http.response.*: error
|
||||
-------------------
|
||||
|
||||
[discrete]
|
||||
=== Querying nested fields
|
||||
|
||||
Querying {ref}/nested.html[nested fields] requires a special syntax. Consider the
|
||||
following document, where `user` is a nested field:
|
||||
|
||||
[source,yaml]
|
||||
-------------------
|
||||
{
|
||||
"user" : [
|
||||
{
|
||||
"first" : "John",
|
||||
"last" : "Smith"
|
||||
},
|
||||
{
|
||||
"first" : "Alice",
|
||||
"last" : "White"
|
||||
}
|
||||
]
|
||||
}
|
||||
-------------------
|
||||
|
||||
To find documents where a single value inside the `user` array contains a first name of
|
||||
“Alice” and last name of “White”, use the following:
|
||||
|
||||
[source,yaml]
|
||||
-------------------
|
||||
user:{ first: "Alice" and last: "White" }
|
||||
-------------------
|
||||
|
||||
Because nested fields can be inside other nested fields,
|
||||
you must specify the full path of the nested field you want to query.
|
||||
For example, consider the following document where `user` and `names` are both nested fields:
|
||||
|
||||
[source,yaml]
|
||||
-------------------
|
||||
{
|
||||
"user": [
|
||||
{
|
||||
"names": [
|
||||
{
|
||||
"first": "John",
|
||||
"last": "Smith"
|
||||
},
|
||||
{
|
||||
"first": "Alice",
|
||||
"last": "White"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
-------------------
|
||||
|
||||
To find documents where a single value inside the `user.names` array contains a first name of “Alice” *and*
|
||||
last name of “White”, use the following:
|
||||
|
||||
[source,yaml]
|
||||
-------------------
|
||||
user.names:{ first: "Alice" and last: "White" }
|
||||
-------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue