Complete the code to specify fields to include in the search response.
{
"_source": {
"includes": [[1]]
}
}The includes field expects an array of field names as strings. Here, including "user.name" will return only that field.
Complete the query to filter documents where the field 'status' equals 'active'.
{
"query": {
"term": {
"status": [1]
}
}
}The term query expects the exact value as a string, so "active" is correct.
Fix the error in the document level security filter to allow only documents with 'role' field equal to 'admin'.
{
"query": {
"bool": {
"filter": {
"term": {
"role": [1]
}
}
}
}
}The term filter requires the value as a string with quotes, so "admin" is correct.
Fill both blanks to create a field level security rule that excludes the 'salary' field and includes the 'name' field.
{
"_source": {
"includes": [[1]],
"excludes": [[2]]
}
}The includes array should have "name" to include that field, and the excludes array should have "salary" to exclude it.
Fill all three blanks to create a document level security query that filters documents where 'department' is 'sales' and only includes 'employee.name' and excludes 'employee.salary'.
{
"query": {
"term": {
"department": [1]
}
},
"_source": {
"includes": [[2]],
"excludes": [[3]]
}
}The term query filters for "sales" in department. The includes array includes "employee.name", and the excludes array excludes "employee.salary".