Recently need to deal with hundreds of millions of data, the author in the recommendation of friends to learn elasticsearch, read many blogs on the internet also encountered a lot of problems,so I record the study and usethe process of elasticsearch. Elasticsearch Concept Online A lot, the author is not more verbose, directly into the actual combat.
I. Environment configuration (window users only)
1. Elasticsearch is a distributed search engine built on Lucene,running requires a Java environment, so first configure the Java environment, install the JDK, here the author uses the version of jdk1.8.0_1442. I am window user, beginnerElasticSearch, many configuration and installation of various plug-ins also need to manually compile the jar, more complex error-prone,so just use it directly
RTF version of Elasticsearch (
https://github.com/medcl/elasticsearch-rtf
)
i downloaded the RTF version of the ES version on GitHub asElasticsearch 5.1.1 (many articles on the Web because the version is different, so some configuration and command may be wrong, this pit I have encountered many times) 2.1 Start This is the author's downloadElasticsearch directory structure, executing in consoleElasticsearch.bat (e.g.)This will start theElasticsearch, and then in the browser, enterHttp://localhost:9200/appear similar to the information,The Elasticsearch environment configuration is OK. 2.2Installing the Elasticsearch head plugin
installation Method One:Https://github.com/mobz/elasticsearch-head download plugins, see documentsRunning with built in server installation Method Two: Search for extensions directly in browserElasticSearch HeadInstall ( chrome requires FQ) The author here directly using the second simple way, the installation succeeded in the browser more than a small icon click on the effect, ElasticSearch Head will be able to use the
Second,ElasticSearch CRUD To facilitate CRUD operations, install the sense plugin directly on the browser (e.g. interface)
Increase put/db_dbname1/tablename1/1{"title": "I am a title", "Author": "Derrick", "Content": "I am a content", "XX": " Yyyyyyy "}put/db_dbname2/person/3{" name ":" Derrick "," Age ":
Modification (
The modification is to match the ID to the existing record. )
、、
Delete
Enquiry
Querying a single record by ID
Querying all libraries, documents for all tables
Finds a document with a field equal to a value in the specified library specified tablemore detailed command reference: https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
third, Chinese participleChinese word-breaker using IK, the default is to split each character into a word, the effect is not goodThe code is as follows:
default Standard participle
,
Note: Some people's articles are directlyget/db_dbname1/_analyze?analyzer=standard{we are God} in this version of my use, it is wrong to write
IK simple participle
There is also a get/db_dbname1/_analyze?analyzer=ik_max_word{"text": "Body Electrical System"}
obviously the default standard participle is not the word we want, so we can set the global word breaker here .
It's not too early, just write it today.
Elasticsearch+.net large data processing (i.)