win10 安裝ElasticSearch7.3

elastic 主頁網(wǎng)站

Elasticsearch

A Distributed RESTful Search Engine

https://www.elastic.co/products/elasticsearch

Elasticsearch is a distributed RESTful search engine built for the cloud. Features include:

  1. Distributed and Highly Available Search Engine.
  • Each index is fully sharded with a configurable number of shards.
  • Each shard can have one or more replicas.
  • Read / Search operations performed on any of the replica shards.
  1. Multi Tenant.
  • Support for more than one index.
  • Index level configuration (number of shards, index storage, ...).
  1. Various set of APIs
  • HTTP RESTful API
  • Native Java API.
  • All APIs perform automatic node operation rerouting.
  1. Document oriented
  • No need for upfront schema definition.
  • Schema can be defined for customization of the indexing process.
  1. Reliable, Asynchronous Write Behind for long term persistency.
  2. (Near) Real Time Search.
  3. Built on top of Lucene
  • Each shard is a fully functional Lucene index
  • All the power of Lucene easily exposed through simple configuration / plugins.
  1. Per operation consistency
  • Single document level operations are atomic, consistent, isolated and durable.

Getting Started

First of all, DON'T PANIC. It will take 5 minutes to get the gist of what Elasticsearch is all about.

Requirements

You need to have a recent version of Java installed.
See the "Setup":http://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html#jvm-version page for more information.

Installation

  • "Download":https://www.elastic.co/downloads/elasticsearch and unzip the Elasticsearch official distribution.
  • Run bin/elasticsearch on unix, or bin\elasticsearch.bat on windows.
  • Run curl -X GET http://localhost:9200/.
  • Start more servers ...
{
  "name" : "DESKTOP-xxxxxx",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "aACf_6akSOmO4OxGSoZMEg",
  "version" : {
    "number" : "7.3.0",
    "build_flavor" : "default",
    "build_type" : "zip",
    "build_hash" : "de777fa",
    "build_date" : "2019-07-24T18:30:11.767338Z",
    "build_snapshot" : false,
    "lucene_version" : "8.1.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Indexing

Let's try and index some twitter like information. First, let's index some tweets (the twitter index will be created automatically):

curl -XPUT 'http://localhost:9200/twitter/_doc/1?pretty' -H 'Content-Type: application/json' -d '
{
    "user": "kimchy",
    "post_date": "2009-11-15T13:12:00",
    "message": "Trying out Elasticsearch, so far so good?"
}'

curl -XPUT 'http://localhost:9200/twitter/_doc/2?pretty' -H 'Content-Type: application/json' -d '
{
    "user": "kimchy",
    "post_date": "2009-11-15T14:12:12",
    "message": "Another tweet, will it be indexed?"
}'

curl -XPUT 'http://localhost:9200/twitter/_doc/3?pretty' -H 'Content-Type: application/json' -d '
{
    "user": "elastic",
    "post_date": "2010-01-15T01:46:38",
    "message": "Building the site, should be kewl"
}'

Now, let's see if the information was added by GETting it:

curl -XGET 'http://localhost:9200/twitter/_doc/1?pretty=true'
curl -XGET 'http://localhost:9200/twitter/_doc/2?pretty=true'
curl -XGET 'http://localhost:9200/twitter/_doc/3?pretty=true'

Searching

Mmm search..., shouldn't it be elastic?
Let's find all the tweets that kimchy posted:

curl -XGET 'http://localhost:9200/twitter/_search?q=user:kimchy&pretty=true'
We can also use the JSON query language Elasticsearch provides instead of a query string:

curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -H 'Content-Type: application/json' -d '
{
    "query" : {
        "match" : { "user": "kimchy" }
    }
}'

Just for kicks, let's get all the documents stored (we should see the tweet from elastic as well):

curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -H 'Content-Type: application/json' -d '
{
    "query" : {
        "match_all" : {}
    }
}'

We can also do range search (the post_date was automatically identified as date)

curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -H 'Content-Type: application/json' -d '
{
    "query" : {
        "range" : {
            "post_date" : { "from" : "2009-11-15T13:00:00", "to" : "2009-11-15T14:00:00" }
        }
    }
}'

There are many more options to perform search, after all, it's a search product no? All the familiar Lucene queries are available through the JSON query language, or through the query parser.

Multi Tenant - Indices and Types

Man, that twitter index might get big (in this case, index size == valuation). Let's see if we can structure our twitter system a bit differently in order to support such large amounts of data.

Elasticsearch supports multiple indices. In the previous example we used an index called twitter that stored tweets for every user.

Another way to define our simple twitter system is to have a different index per user (note, though that each index has an overhead). Here is the indexing curl's in this case:

curl -XPUT 'http://localhost:9200/kimchy/_doc/1?pretty' -H 'Content-Type: application/json' -d '
{
    "user": "kimchy",
    "post_date": "2009-11-15T13:12:00",
    "message": "Trying out Elasticsearch, so far so good?"
}'

curl -XPUT 'http://localhost:9200/kimchy/_doc/2?pretty' -H 'Content-Type: application/json' -d '
{
    "user": "kimchy",
    "post_date": "2009-11-15T14:12:12",
    "message": "Another tweet, will it be indexed?"
}'

The above will index information into the kimchy index. Each user will get their own special index.

Complete control on the index level is allowed. As an example, in the above case, we would want to change from the default 5 shards with 1 replica per index, to only 1 shard with 1 replica per index (== per twitter user). Here is how this can be done (the configuration can be in yaml as well):

curl -XPUT http://localhost:9200/another_user?pretty -H 'Content-Type: application/json' -d '
{
    "index" : {
        "number_of_shards" : 1,
        "number_of_replicas" : 1
    }
}'

Search (and similar operations) are multi index aware. This means that we can easily search on more than one
index (twitter user), for example:

curl -XGET 'http://localhost:9200/kimchy,another_user/_search?pretty=true' -H 'Content-Type: application/json' -d '
{
    "query" : {
        "match_all" : {}
    }
}'

Or on all the indices:

curl -XGET 'http://localhost:9200/_search?pretty=true' -H 'Content-Type: application/json' -d '
{
    "query" : {
        "match_all" : {}
    }
}'

{One liner teaser}: And the cool part about that? You can easily search on multiple twitter users (indices), with different boost levels per user (index), making social search so much simpler (results from my friends rank higher than results from friends of my friends).

Distributed, Highly Available

Let's face it, things will fail....

Elasticsearch is a highly available and distributed search engine. Each index is broken down into shards, and each shard can have one or more replicas. By default, an index is created with 5 shards and 1 replica per shard (5/1). There are many topologies that can be used, including 1/10 (improve search performance), or 20/1 (improve indexing performance, with search executed in a map reduce fashion across shards).

In order to play with the distributed nature of Elasticsearch, simply bring more nodes up and shut down nodes. The system will continue to serve requests (make sure you use the correct http port) with the latest data indexed.

Where to go from here?

We have just covered a very small portion of what Elasticsearch is all about. For more information, please refer to the elastic.co website. General questions can be asked on the Elastic Discourse forum or on IRC on Freenode at elasticsearch. The Elasticsearch GitHub repository is reserved for bug reports and feature requests only.

Building from Source

Elasticsearch uses "Gradle":https://gradle.org for its build system.

In order to create a distribution, simply run the ./gradlew assemble command in the cloned directory.

The distribution for each project will be created under the build/distributions directory in that project.

See the TESTING file for more information about running the Elasticsearch test suite.

Upgrading from older Elasticsearch versions

In order to ensure a smooth upgrade process from earlier versions of Elasticsearch, please see our upgrade documentation for more details on the upgrade process.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末魔眨,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子酿雪,更是在濱河造成了極大的恐慌遏暴,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,807評(píng)論 6 518
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件执虹,死亡現(xiàn)場(chǎng)離奇詭異拓挥,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)袋励,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,284評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門侥啤,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人茬故,你說我怎么就攤上這事盖灸。” “怎么了磺芭?”我有些...
    開封第一講書人閱讀 169,589評(píng)論 0 363
  • 文/不壞的土叔 我叫張陵赁炎,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我钾腺,道長(zhǎng)徙垫,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 60,188評(píng)論 1 300
  • 正文 為了忘掉前任放棒,我火速辦了婚禮姻报,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘间螟。我一直安慰自己吴旋,他們只是感情好损肛,可當(dāng)我...
    茶點(diǎn)故事閱讀 69,185評(píng)論 6 398
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著荣瑟,像睡著了一般治拿。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上笆焰,一...
    開封第一講書人閱讀 52,785評(píng)論 1 314
  • 那天劫谅,我揣著相機(jī)與錄音,去河邊找鬼仙辟。 笑死同波,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的叠国。 我是一名探鬼主播未檩,決...
    沈念sama閱讀 41,220評(píng)論 3 423
  • 文/蒼蘭香墨 我猛地睜開眼查吊,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼氏豌!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起递雀,我...
    開封第一講書人閱讀 40,167評(píng)論 0 277
  • 序言:老撾萬榮一對(duì)情侶失蹤项棠,失蹤者是張志新(化名)和其女友劉穎悲雳,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體香追,經(jīng)...
    沈念sama閱讀 46,698評(píng)論 1 320
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡合瓢,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,767評(píng)論 3 343
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了透典。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片晴楔。...
    茶點(diǎn)故事閱讀 40,912評(píng)論 1 353
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖峭咒,靈堂內(nèi)的尸體忽然破棺而出税弃,到底是詐尸還是另有隱情,我是刑警寧澤凑队,帶...
    沈念sama閱讀 36,572評(píng)論 5 351
  • 正文 年R本政府宣布则果,位于F島的核電站,受9級(jí)特大地震影響漩氨,放射性物質(zhì)發(fā)生泄漏西壮。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,254評(píng)論 3 336
  • 文/蒙蒙 一叫惊、第九天 我趴在偏房一處隱蔽的房頂上張望款青。 院中可真熱鬧,春花似錦赋访、人聲如沸可都。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,746評(píng)論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽渠牲。三九已至,卻和暖如春步悠,著一層夾襖步出監(jiān)牢的瞬間签杈,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,859評(píng)論 1 274
  • 我被黑心中介騙來泰國(guó)打工鼎兽, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留答姥,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 49,359評(píng)論 3 379
  • 正文 我出身青樓谚咬,卻偏偏與公主長(zhǎng)得像鹦付,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子择卦,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,922評(píng)論 2 361

推薦閱讀更多精彩內(nèi)容