分布式爬虫之elasticsearch基础1

一:搜索引擎elasticsearch介绍

    Elasticsearch 是一个全文搜索引擎,可以快速地储存、搜索和分析海量数据。

二:应用场景

  • 海量数据分析引擎
  • 站内搜索引擎
  • 数据仓库

三:安装

我们可以到 Elasticsearch 的官方网站下载 Elasticsearch:https://www.elastic.co/downloads/elasticsearch,同时官网也附有安装说明。

首先把安装包下载下来并解压,然后运行 bin/elasticsearch(Mac 或 Linux)或者 binelasticsearch.bat (Windows) 即可启动 Elasticsearch 了。

Elasticsearch 默认会在 9200 端口上运行,我们打开浏览器访问http://localhost:9200/ 

四:Elasticsearch 相关概念

Node 和 Cluster

Elasticsearch 本质上是一个分布式数据库,允许多台服务器协同工作,每台服务器可以运行多个 Elasticsearch 实例。

单个 Elasticsearch 实例称为一个节点(Node)。一组节点构成一个集群(Cluster)。

Index

Elasticsearch 会索引所有字段,经过处理后写入一个反向索引(Inverted Index)。查找数据的时候,直接查找该索引。每个 Index (即数据库)的名字必须是小写。

Document

Index 里面单条的记录称为 Document(文档)。许多条 Document 构成了一个 Index。Document 使用 JSON 格式表示

Type

Document 可以分组它是虚拟的逻辑分组,用来过滤 Document,类似 MySQL 中的数据表,MongoDB 中的 Collection。

Fields

即字段,每个 Document 都类似一个 JSON 结构,它包含了许多字段,每个字段都有其对应的值,多个字段组成了一个 Document,其实就可以类比 MySQL 数据表中的字段。

类比传统数据库:

Relational DB -> Databases -> Tables -> Rows -> Columns
Elasticsearch -> Indices   -> Types  -> Documents -> Fields
原文地址:https://www.cnblogs.com/lmx123/p/9995425.html