January 2018
Intermediate to advanced
336 pages
7h 22m
English
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": [ |
| | { |
| | "_index": "books", |
| | "_type": "book", |
| | "_id": "pg100", |
| | "_score": 1, |
| | "_source": { |
| | "id": 100, |
| | "title": "The ... |
Read now
Unlock full access