-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Moves the source filtering example snippets form the "Request body search" API docs page to the "Return fields in a search" section of the "Run a search" page.
- Loading branch information
Showing
4 changed files
with
95 additions
and
72 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,4 @@ | ||
[[request-body-search-source-filtering]] | ||
==== Source filtering | ||
|
||
|
||
Allows to control how the `_source` field is returned with every hit. | ||
|
||
By default operations return the contents of the `_source` field unless | ||
you have used the `stored_fields` parameter or if the `_source` field is disabled. | ||
|
||
You can turn off `_source` retrieval by using the `_source` parameter: | ||
|
||
To disable `_source` retrieval set to `false`: | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
GET /_search | ||
{ | ||
"_source": false, | ||
"query" : { | ||
"term" : { "user" : "kimchy" } | ||
} | ||
} | ||
-------------------------------------------------- | ||
|
||
The `_source` also accepts one or more wildcard patterns to control what parts of the `_source` should be returned: | ||
|
||
For example: | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
GET /_search | ||
{ | ||
"_source": "obj.*", | ||
"query" : { | ||
"term" : { "user" : "kimchy" } | ||
} | ||
} | ||
-------------------------------------------------- | ||
|
||
Or | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
GET /_search | ||
{ | ||
"_source": [ "obj1.*", "obj2.*" ], | ||
"query" : { | ||
"term" : { "user" : "kimchy" } | ||
} | ||
} | ||
-------------------------------------------------- | ||
|
||
Finally, for complete control, you can specify both `includes` and `excludes` | ||
patterns. If `includes` is not empty, then only fields that match one of the | ||
patterns in `includes` but none of the patterns in `excludes` are provided in | ||
`_source`. If `includes` is empty, then all fields are provided in `_source`, | ||
except for those that match a pattern in `excludes`. | ||
|
||
[source,console] | ||
-------------------------------------------------- | ||
GET /_search | ||
{ | ||
"_source": { | ||
"includes": [ "obj1.*", "obj2.*" ], | ||
"excludes": [ "*.description" ] | ||
}, | ||
"query" : { | ||
"term" : { "user" : "kimchy" } | ||
} | ||
} | ||
-------------------------------------------------- | ||
See <<search-fields>>. |
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