I. Installation of Elasticsearch
elasticsearch Download Address: http://www.elasticsearch.org/download/
• Download direct decompression, into the directory under the bin, under the cmd run Elasticsearch.bat can start Elasticsearch
• Browser access: Http://localhost:9200/, if the following results appear similar to the installation success:
{
"name": "Benedict kine",
"cluster_name": "Elasticsearch",
"version": {
"number": "2.2.0",
" Build_hash ":" 8ff36d139e16f8720f2947ef62c8167a888992fe ","
Build_timestamp ":" 2016-01-27t13:32:39z ",
" Build_snapshot ": false,
" lucene_version ":" 5.4.1 "
},
" tagline ":" You Know, for Search "
}
which
name ——— The name of the Elasticsearch instance, by default it will randomly select one from the list of names, which is set in the Config/elasticsearch.yml file;
version ——— version number, which represents a set of information in JSON format, where:
The number field represents the version numbers of the currently running Elasticserch;
The Build_snashot field represents whether the current version is built from the source code;
Lucene_version represents the version of Lucene on which Elasticsearch is based;
The tagline ——— contains the first tagline of Elasticsearch: "You are Know, for Search".
Ii. Rich-text version
Beginners can start with the rich-text version of Elastisearch. RTF is the abbreviation for ready to fly, which is an integrated basic plug-in (such as service encapsulation, Chinese participle, mapper-attachments, transport-thrift, Tools.carrot2 and other plug-ins) with a sample program can be directly hands-on with the proposed project version.
Download Address: Https://github.com/medcl/elasticsearch-rtf
After decompression, you will see its directory structure. The main folders and functions included in the Elasticsearch are as follows (for example, in the TF version):
bin--contains scripts to run Elasticsearch instances and manage plug-ins;
config--is mainly a few settings files
lib--contains a number of related package files;
plugins--contains the relevant plug-in files, etc.;
logs--log file;
Where the data is stored in the data--elasticsearch;
works--temporary files.
Introduction and installation of Plug-ins
1.Head
the head is a client plug-in used to monitor the Elasticsearch state.
Installation: to the bin directory plugin install Mobz/elasticsearch-head
After installation and then enter in the browser: http://localhost:9200/_plugin/head/, will open the following interface:
The figure shows a node Benedict Kine, each node has different index data, and the head provides the HTTP client.
2.Marvel
Marvel is a elasticsearch, graphical monitoring client that can be used to view current status.
Installation:
The Marvel is in the form of a Elasticsearch plug-in that can be installed directly through a plugin:
#./bin/plugin-i Elasticsearch/marvel/latest
If you are downloading the installation package from the official website, then run:
#./bin/plugin-i Marvel File:///path/to/marvel-latest.zip
Run:
In the browser, enter: http://localhost:9200/_plugin/marvel/, the following interface will open:
Second, the use of head to build the index
when Elasticsearch is started, it is accessed in the browser: http://localhost:9200/_plugin/head/opens the Head tool.
Step1:
Click the new Index button to create a new index and enter the name of the index in the pop-up box, as shown in the following illustration. The number of fragments is 5, followed by 0,1,2,3,4. The copy of the data is 1,
The following results are shown in the overview to successfully create the index. A fragmented copy of the image with a thick box is the copy of the data provided.
Step2:
under the All Request tab of the Head tool, open the query option, as shown in the following illustration.
- Enter the name of the index file where the data is to be submitted (here with the newly built index file name Myfirstindex) and type (here with share), the unique identifier for the index document (that is, the ID number of the index, here is 1);
- Select the mode of operation, which is selected Post,post as equivalent to insert;
- Enter the JSON data that you intend to add in the text box;
- When submitted, the specified information is written in the type file share of the index file Myfirstindex. If the right content appears, the identity write succeeds.
Third, query index
or under the Composite Query tab, select the Get action type (equivalent to select), and you can see the details of the index file as shown in the following figure.
Iv. operating Instructions
The Elasticsearch's head uses 4 of the HTTP protocol's request methods, including:
- Post is the number of submissions to the server;
- Get is to send a request to obtain a resource on the server;
- Put and post all send data to the server, but it usually specifies where the resource is stored;
- Delete is used to remove a resource on the server.
V. Brief introduction of mapping
The mapping in Elasticsearch is similar to the data type in a static language. But there are other meanings to the image, such as executing a series of instructions, converting the entered data into searchable index entries, and using the image to query the information for each field of the type file.
VI. Information Retrieval
using the Head tool, the user can construct a simple information retrieval statement by means of HTTP pass parameters. The following figure specifies that in the share of the Myfirstindex index, the search field city_name its value to the way the retrieval request of Beijing is built.
The hits in the right-hand side of the graph can see the result returned, hits represents the retrieved collection of hits, total represents a hit of 2 records, and Max_score is its score.
When the URL constructs the query statement, the _search represents the search restful interface, q after the query condition, q is the query expression based on the Lucene syntax.