Complete the code to create an index in Elasticsearch.
PUT /[1]The PUT command creates an index named my-index in Elasticsearch.
Complete the code to add a document to the Elasticsearch index.
POST /my-index/_doc/[1] { "user": "alice", "message": "Hello Kibana!" }
The document ID 1 uniquely identifies the document in the index.
Fix the error in the query to retrieve all documents from the index.
GET /my-index/_search
{
"query": {
[1]: { "match_all": {} }
}
}query, which is not a valid query type.match which expects a field.Inside the query object, match_all: {} retrieves all documents from the index.
Fill both blanks to create a Kibana visualization that shows the count of documents per user.
{
"aggs": {
"users": {
[1]: {
"field": "[2]"
}
}
}
}count as aggregation type which is invalid here.message field instead of user.The terms aggregation groups documents by the user field to count them.
Fill all three blanks to filter documents where the message contains 'Kibana' and visualize the count per user.
{
"query": {
"match": {
"[1]": "Kibana"
}
},
"aggs": {
"users": {
"[2]": {
"field": "[3]"
}
}
}
}match_all in the query instead of match.The query matches the message field for 'Kibana'. The aggregation uses terms on the user field to count documents per user.