项目作者: zucchinidev

项目描述 :
NodeJS application to manage e-books from Project Gutenberg.
高级语言: JavaScript
项目地址: git://github.com/zucchinidev/book-bundle-builder.git
创建时间: 2018-11-11T12:30:10Z
项目社区:https://github.com/zucchinidev/book-bundle-builder

开源协议:MIT License

下载


Book-manager - Project Gutenberg

Initializing project.

We need the external data used in this project. We use free ebooks from Project Gutenberg and we need to download them.

All e-books are inserted in elasticsearch, so you must
start it before executing the initialization script:

  1. docker-compose up

Then, you must execute the initialize script.

This action should only be executed the first time.!!!

  1. ./initialize-project.sh

Initializing project download data

After a few minutes:

Result

All books will be in elasticsearch!!!!

When everything is finished, you can recover some records with this instruction:

Nodejs Runtime and the JQ package must be in your system.

  1. ./src/elasticsearch-cli/bin.js get '_search' | jq '.' | head -n 50
  1. {
  2. "took": 76,
  3. "timed_out": false,
  4. "_shards": {
  5. "total": 5,
  6. "successful": 5,
  7. "skipped": 0,
  8. "failed": 0
  9. },
  10. "hits": {
  11. "total": 58250,
  12. "max_score": 1,
  13. "hits": [
  14. {
  15. "_index": "books",
  16. "_type": "book",
  17. "_id": "pg100",
  18. "_score": 1,
  19. "_source": {
  20. "id": 100,
  21. "title": "The Complete Works of William Shakespeare",
  22. "authors": [
  23. "Shakespeare, William"
  24. ],

You can see more options of the elasticsearch-cli application by running:

  1. $ ./src/elasticsearch-cli/bin.js
  2. Usage: bin [options] <command> [...]
  3. Options:
  4. -V, --version output the version number
  5. -o, --host <hostname> hostname [localhost] (default: "localhost")
  6. -p, --port <number> port number [9200] (default: "9200")
  7. -j, --json format output as JSON
  8. -i, --index <name> which index to use
  9. -t, --type <type> default type for bulk operations
  10. -f, --filter <filter> source filter for query results
  11. -h, --help output usage information
  12. Commands:
  13. get [path] generate the URL for the options and path (default is /)
  14. create-index Create an index in Elasticsearch
  15. list-indices|li Get a list of indices in the cluster
  16. bulk <file> Read and perform bulk options from the specified file
  17. query|q [queries...] Perform an Elasticsearch query
  18. delete-index Delete a index in Elasticsearch