Elasticsearch is a very useful search engine, it is the bottom of the integration of luence, so also inherited the inverted indexing principle. To use elasticsearch here we need a few tools and follow these steps.
This project is just as a basic introductory demo Elasticsearch simple function reference, the actual deployment of multiple nodes and the idea of dealing with the actual business can refer to this blog two articles: 1.elasticsearch5.x on Linux distributed Installation (Multi-node) 2. Elasticsearch Distributed Services with Java
1. Need to download the Elasticsearch service.
Download Address: Https://www.elastic.co/products/elasticsearch
After downloading, if it is a Windows user, double-click the Elasticsearch.bat under the bin directory, if there is no error, the normal operation, the browser input locahost:9200, the following figure:
This represents already successful, if the error has been run, most of the reason is that the JDK version is too low, the use of the 5.4 here must be jdk1.8 version, or it will be an error.
2. Need to download a head plugin
Download Address: Https://github.com/mobz/elasticsearch-head
Decompression after Windows download is finished
3. Because more than 5.x need to open the page Head plug-in, but also need to NODEJS environment
If it is Windows users directly to the NODEJS website download the latest, it is recommended to download. msi. After the installation is successful, enter in CMD separately
If the correct display of the version is good, it will be successful (high version of Nodejs with NPM)
There is a need to change NPM to a mirror, because the speed of download at home disappointments
To modify the mirroring command for NPM:
NPM install-g cnpm--registry=https://registry.npm.taobao.org
Then replace NPM with CNPM.
4. Install grunt using NPM
NPM install-g GRUNT-CLI
5. To just download the head plugin, after decompression to get Elasticsearch-head-master folder, cmd into this directory
Using the CNPM Install command
6. Add two lines to the Elasticsearch-5.4.3/config/elasticsearch.yml file:
Http.cors.enabled:true
Http.cors.allow-origin: "*"
7. Add hostname to the Gruntfile.js document under the Elasticsearch-head-master document: ' 0.0.0.0 ',
Connect: {
Server: {
Options: {
Hostname: ' 0.0.0.0 ',
PORT:9100,
Base: '. ',
Keepalive:true
}
}
}
8. Running Grunt Service
CMD into Elasticsearch-head-master folder using Grunt Server command
9. Enter localhost:9100 on the webpage, click Connect
This Elasticsearch tool is installed