Implementing an Elasticsearch Query Command
Now that the documents are in the index, we can start querying for them. First weâll take a look around using the existing get command, and then weâll implement a specific command just for querying.
The Elasticsearch API endpoint we want to hit is /_search. We can already hit this endpoint using the get command. Letâs try that now.
â | â$ ââ./escluââ ââgetââ ââ'_search'ââ ââ|ââ ââjqââ ââ'.'ââ ââ|ââ ââheadââ ââ-nââ ââ20â |
â | { |
â | "took": 3, |
â | "timed_out": false, |
â | "_shards": { |
â | "total": 5, |
â | "successful": 5, |
â | "failed": 0 |
â | }, |
â | "hits": { |
â | "total": 53212, |
â | "max_score": 1, |
â | "hits": ... |
Get Node.js 8 the Right Way now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.