Elasticsearch provides a search facility by passing /_search at the end of the URL. It can be applied after the server URL, the index, or the type. For example, in our case, if we want to search a student document having name equals to nilang, we have to use the query as follows.
With a REST client (Postman), use the following:
- URL: http://localhost:9200/students/student/_search?q=name:nilang
- Method: GET
With Kibana, use:
GET students/student/_search?q=name:nilang
Alternatively, you can use the following syntax for searching. It is quite useful for a complex search with multiple search criteria for multiple fields:
GET students/student/_search
{
"query": {
"match": {
"name": "nilang"
}
}
}