Complete the code to include only the title field in the search results.
{
"_source": [1],
"query": {
"match_all": {}
}
}The _source field controls which fields are returned. Using ["title"] returns only the title field.
Complete the code to exclude the comments field from the search results.
{
"_source": {
"excludes": [1]
},
"query": {
"match_all": {}
}
}includes instead of excludes.Using "excludes": ["comments"] tells Elasticsearch to omit the comments field from the results.
Fix the error in the code to correctly include only the author and date fields.
{
"_source": [1],
"query": {
"match_all": {}
}
}The _source field expects an array of field names. Option A correctly provides an array with two fields.
Fill both blanks to include only the title and summary fields, and exclude the comments field.
{
"_source": {
"includes": [1],
"excludes": [2]
},
"query": {
"match_all": {}
}
}Use includes to specify fields to return and excludes to specify fields to omit.
Fill all three blanks to include the title field in uppercase, include the author field, and exclude the comments field.
{
"_source": {
"includes": [[1], [3]],
"excludes": [[2]]
},
"script_fields": {
"title_upper": {
"script": {
"source": "doc['title'].value.toUpperCase()"
}
}
},
"query": {
"match_all": {}
}
}The includes array contains "title" and "author" fields, while excludes contains "comments". The script field creates an uppercase version of the title.