Elasticsearch allows the users to search and fetch the documents from the database in two ways. We can use one of them accordingly -