Skip to content

junglestory/elasticsearch-node.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elasticsearch-node.js

This application is a sample for Elasticsearch client with node.js and Pug, Bootstrap.

Features

  • Match Query
  • Paginated

Requirements

  • NPM
  • Elasticsearch requires 5.5 or higher

Installation

Soruce code clone

git clone https://github.com/junglestory/elasticsearch-node.js.git


$ cd elasticsearch-node.js

Configuration

  • elasticsearch.js

var client = new elasticsearch.Client({
  host: '[your host]',
  log: 'trace'
});
  • /routes/search.js

elastic.getSearch([index], [type], query, pageNum, perPage, function (results) {
		 	totalCount = results.length;
			pageCount = Math.ceil(totalCount / perPage);	        
	        res.render('search', { query: query, totalCount: totalCount, pageCount: pageCount, results: results});
	    });

Run


$ npm install
$ npm start

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published