Node.js 8 the Right Way by Jim Wilson
Author:Jim Wilson
Language: eng
Format: epub
Tags: Pragmatic Bookshelf
Publisher: Pragmatic Bookshelf
Now, continuing with the previous example, if the user only wanted to get back the title field of matching documents, then the thing to do is add -f title to the command line. request would then encode both options together as ?q=Mark%20Twain&_source=title.
After you save the file, give the new query command a try. The simplest query is the empty query, which matches all documents.
$ ./esclu q | jq '.' | head -n 30
{
"took": 4,
"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 Complete Works of William Shakespeare",
"authors": [
"Shakespeare, William"
],
"subjects": [
"English drama -- Early modern and Elizabethan, 1500-1600"
]
}
},
{
"_index": "books",
To abbreviate output, we can focus on just the title and author fields.
$ ./esclu q -f title,authors | jq '.' | head -n 30
{
"took": 5,
"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": {
"title": "The Complete Works of William Shakespeare",
"authors": [
"Shakespeare, William"
]
}
},
{
"_index": "books",
"_type": "book",
"_id": "pg1000",
"_score": 1,
"_source": {
Now using jq we can focus on just the source objects.
$ ./esclu q -f title,authors | jq '.hits.hits[]._source' | head -n 30
{
"title": "The Complete Works of William Shakespeare",
"authors": [
"Shakespeare, William"
]
}
{
"title": "La Divina Commedia di Dante: Complete",
"authors": [
"Dante Alighieri"
]
}
{
"title": "The Magna Carta",
"authors": [
"Anonymous"
]
}
{
"title": "My First Years as a Frenchwoman, 1876-1879",
"authors": [
"Waddington, Mary King"
]
}
{
"title": "A Voyage to the Moon\r\nWith Some Account of the Manners and ...
"authors": [
"Tucker, George"
]
}
Taking advantage of the joining of query parts, you can specify a complex query without wrapping it in quotes.
$ ./esclu q authors:Shakespeare AND subjects:Drama -f title |\
jq '.hits.hits[]._source.title'
"The Tragedy of Othello, Moor of Venice"
"The Tragedy of Romeo and Juliet"
"The Tempest"
"The Comedy of Errors"
"Othello"
"As You Like It"
"The Two Gentlemen of Verona"
"The Merchant of Venice"
"Two Gentlemen of Verona"
"All's Well That Ends Well"
Be aware that if you need any characters that your shell treats as special, you should wrap the whole query in quotes. For example, to do a multiword query with Elasticsearch you can wrap the expression in double quotes (q title:"United States"). But your shell may strip out these quotes unless they’re wrapped in another set of quotes (q ’title:"United States"’).
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9914)
The Mikado Method by Ola Ellnestam Daniel Brolund(9778)
Dependency Injection in .NET by Mark Seemann(9337)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7778)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Svelte with Test-Driven Development by Daniel Irvine(7153)
Test-Driven Development with PHP 8 by Rainier Sarabia(6879)
Layered Design for Ruby on Rails Applications by Dementyev Vladimir;(6750)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6532)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6413)
Web Development with Django by Ben Shaw Saurabh Badhwar(6216)
React Application Architecture for Production by Alan Alickovic(5941)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5806)
Kotlin in Action by Dmitry Jemerov(5062)
Audition by Ryu Murakami(4583)
Software Architecture for Web Developers by Mihaela Roxana Ghidersa(4450)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4316)
Accelerating Server-Side Development with Fastify by Manuel Spigolon Maksim Sinik & Matteo Collina(4296)
Functional Programming in JavaScript by Mantyla Dan(4038)
