OverviewElasticsearch (ES) is a Lucene-based open source search engine, which is stable, reliable, fast, and also has a good level of scalability, is specifically designed for the distributed environment.Characteristics
Easy to install: No other dependencies, download after the installation is very convenient; just modify a few parameters to build up a cluster
JSON: the input/output format is JSON, which means you don't need to define a S
Using Elasticsearch to achieve site search, can support product search, filter search, price sorting, scoring filter items aggregation, and other comprehensive sortingFollow-up Search manual intervention sequencing, according to sales, praise rate, sales rate for a full rang
Elasticsearch supports batch addition or deletion of index documents. In Java APIs, bulkrequestbuilder is constructed, batch index/delete requests are added to bulkrequestbuilder, and bulkrequestbuilder is executed. The following is an example:
Import static Org. elasticsearch. common. xcontent. xcontentfactory. *; bulkrequestbuilder bulkrequest = client. preparebulk (); bulkrequest. add (client. prepareind
1. Install Elasticsearch and IK plugins ①elasticsearch integration pack (including IK Chinese plug-in) installation address: Https://github.com/medcl/elasticsearch-rtf② Test Installation
Start Elasticsearch:bin/elasticsearch-d③ test whether the installation of 127.0.0.1:9200 2.Elas
gets the list of documents that contain the entry, in which case the document is 1 2 3 returned.
Score each documenttermThe query calculates its relevance score for each matching document, which is calculated _score by taking into account the frequency of the entry (term Frequency) (the frequency of occurrences in the "quick" field of each document that matches title ), and the frequency of the rewind (inverted document Frequency) (the extent to which the "quick" fields of all documents in
The following ES are based on version (V2.3.4)The default of ES1. Default automatically sends all cluster nodes of the same LAN first2. The default one index library will have 5 shards (the more shards, the better the efficiency)Because of these two defaults, the Shard pairs of the Unified Index library are distributed on different machines, and the API search has this problemSearch Type of ES1. Why do you have this thing?, these two problems occur:Th
While Elasticsearch can support full-text retrieval in a variety of languages, we don't want to switch to Elasticsearch as the backend database for the time being.
Of course, when you can store data in a Web application, write a copy of it to Elasticsearch, but it certainly pollutes the original business logic.
In the IT industry, as long as there is demand, ther
" ] } }}Smith's high IDF value in the First_Name field will overwhelm Peter's two low IDF values in the First_Name field and Smith in the Last_Name field.Solution SolutionsThis problem only exists when we are dealing with multiple fields. If we merge all of these fields into a single field, the problem will no longer exist. We can add a full_name field to the person document to implement:{ "first_name" : "Peter" , "last_name" : "Smith" , "full_name" : "Peter Smith" }When we only query
Elasticsearch-head is a cluster management tool of elasticsearch. It is an independent web page program fully compiled by html5. you can integrate it into es through plug-ins. Or directly download the source code, and open index.html in the terminal to run it. The GIT address for this tool is: https://github.com/Aconex/elasticsearch-head
Plugin installation meth
of ES, ES will automatically load balance the search request.RecoveryRepresents data recovery or redistribution of data, ES when a node joins or exits the index shards are redistributed based on the load of the machine, and data recovery occurs when the node is restarted.RiverRepresents a data source for ES and is also a way to synchronize data to ES with other storage methods (such as databases). It is an ES service that exists as a plug-in, and by
An elasticsearch node has multiple thread pools, but the following four are important:Index: mainly refers to data indexing and data deletion operations (the default type is cached)Search: mainly for obtaining, statistics, and search operations (the default type is cached)BULK: mainly refers to batch operations on indexes (the default type is cached)Refresh: main
To group queries by aggregation: SearchResponse response = Client.preparesearch (Index_douban). Settypes (Type_douban). Addaggregation (Aggregationbuilders.terms ("By_" +tag). Field (TAG). Size (1000)). Execute (). Actionget ();Terms Terms = Response.getaggregations (). Get ("By_" +tag);For (Bucket b:terms.getbuckets ()) {Sum sum = b.getaggregations (). Get ("sum");List.add (String) B.getkey ());System.out.println ("Filedname:" +b.getkey () + "Doccount:" +b.getdoccount ());}It is important to n
Elasticsearch-head is a elasticsearch cluster management tool, which is a standalone web program written entirely by HTML5, and you can integrate it into ES via plugins. or directly download the source code, open index.html locally to run it. The GIT address for this tool is: Https://github.com/Aconex/elasticsearch-head
Plug-in Installation method: 1.
elasticsearch-Full-Text Search execution process
Check the field type.
The caption Title field is a string type (analyzed) of the parsed full-text segment, which means that the query string itself should also be parsed.
Parses the query string.
quick! the query string In the standard parser, the result of the output is a single item quick. Because there is only one word entry, the match query executes
Elasticsearch-head is a elasticsearch cluster management tool, which is a stand-alone Web program written entirely by HTML5, which you can integrate into ES through Plug-ins. or directly download the source code, open index.html on the local run it. The tool's git address is: https://github.com/Aconex/elasticsearch-head
Plug-in installation method: 1.
Elasticsearch runs in a Linux system environment and requires a series of Optimization on the Linux system, which can improve the retrieval efficiency of elasticsearch. The main parameters to be optimized are as follows:
1.LinuxAdjust the number of files
/Etc/security/limits. conf
Add
* Soft nofile 8192
* Hard nofile 20480
*-Memlock Unlimited
Add the following command line in Login
/Etc/PAM. d/login
Se
Elasticsearch provides a simple analysis of the index logic. Here we will only clarify the main context, and some details will be elaborated in future articles. If you call the elasticsearch index interface through Java APIs, you first construct a JSON string (represented as xcontent in ES, which is an abstraction of the content to be processed ), in indexrequest, specify the index to which the document wil
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.