Complete the code to create a term query that searches for documents where the field 'user' exactly matches 'kimchy'.
{
"query": {
"term": {
"user": [1]
}
}
}The term query requires the exact value to match, so the value for the 'user' field should be the string "kimchy".
Complete the code to create a term query that searches for documents where the field 'status' exactly matches the value 'active'.
{
"query": {
"term": {
"status": [1]
}
}
}The term query needs the exact value to match, so the value for 'status' should be "active".
Fix the error in the term query to correctly search for documents where 'age' is exactly 30.
{
"query": {
"term": {
"age": [1]
}
}
}The term query expects the exact value type. Since 'age' is a number, the value should be the number 30 without quotes.
Fill both blanks to create a term query that searches for documents where the field 'category' exactly matches 'books'.
{
"query": {
[1]: {
[2]: "books"
}
}
}Inside the "query", use "term" as the query type and "category" as the field name with value "books".
Fill all three blanks to create a term query that searches for documents where the field 'status' exactly matches 'pending'.
{
[1]: {
[2]: {
[3]: "pending"
}
}
}The outermost key is "query", inside it the "term" query, and then the field name "status" with the value "pending".