当前位置: 首页 > news >正文

wps免费模板网站商丘网站优化公司

wps免费模板网站,商丘网站优化公司,网站注册域名查询,网站流量下降的原因Elasticsearch,一个强大的开源搜索和分析引擎,已经在全球范围内被广泛应用于各种场景,包括网站搜索、日志分析、实时应用等。由于其强大的功能和灵活性,Elasticsearch 已经成为大数据处理的重要工具。然而,对于许多初次…

Elasticsearch,一个强大的开源搜索和分析引擎,已经在全球范围内被广泛应用于各种场景,包括网站搜索、日志分析、实时应用等。由于其强大的功能和灵活性,Elasticsearch 已经成为大数据处理的重要工具。然而,对于许多初次接触 Elasticsearch 的人来说,如何正确安装和配置 Elasticsearch 可能会有些困惑。因此,本文将详细介绍如何在不同的操作系统上安装 Elasticsearch,帮助你快速搭建起 Elasticsearch 的开发或测试环境。


文章目录

        • 1、Elasticsearch安装步骤
          • 1.1、下载
          • 1.2、解压
          • 1.3、启动
          • 1.4、验证
          • 1.5、注意
        • 2、Postman交互
          • 1.1、检查 Elasticsearch 服务状态
          • 1.2、创建一个新的索引
          • 1.3、获取指定索引的信息
          • 1.4、添加文档
          • 1.5、查询指定索引中的所有文档
          • 2.6、其他


1、Elasticsearch安装步骤
1.1、下载

官网下载地址:https://www.elastic.co/cn/downloads/elasticsearch

选择对应配置与版本下载:

image-20231001145824044

1.2、解压

下载压缩包后解压

1.3、启动

其实不存在什么安装不安装,解压完之后 ES 就能直接用了,我们打开文件包,再打开 bin/ 目录,然后打开这个叫 elasticsearch 的文件,即可启动 ElasticSearch::

image-20231001150111456

打开之后等一等:

image-20231001144802593

1.4、验证

Elasticsearch 默认使用端口为 9200,我们打开浏览器,输入域名:

http://localhost:9200/

可以看到:

image-20231001145518914

至此,恭喜你,ElasticSearch 安装成功了。

1.5、注意

如果报错:

received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/[0:0:0:0:0:0:0:1]:9200

原因是 Elasticsearch 开启了安全认证,虽然 started 成功,但访问 http://localhost:9200/ 失败。

解决方案:

找到 config/ 目录下面的 elasticsearch.yml 配置文件,把安全认证开关从原先的 true 都改成 false,实现免密登录访问即可,修改这两处都为 false 后:

image-20231001150500333


2、Postman交互

Elasticsearch 可以与 Postman 交互。Elasticsearch 提供了 RESTful API,可以通过 HTTP 请求进行交互,而 Postman 是一个非常流行的 API 测试工具,可以用来发送 HTTP 请求,因此可以用来与 Elasticsearch 进行交互。

1.1、检查 Elasticsearch 服务状态
方法:GET
URL:http://localhost:9200/

这个 API 用于检查 Elasticsearch 服务的状态,它没有入参。

image-20231001154011320

出参 JSON 对象包含了以下信息:

  • name:节点名称;
  • cluster_name:集群名称;
  • cluster_uuid:集群的唯一标识符;
  • version:包含了关于 Elasticsearch 版本的一些信息,如版本号、构建类型、构建日期等;
  • tagline:Elasticsearch 的标语

通过这个 API,你可以快速检查 Elasticsearch 服务是否正常运行,以及获取服务的一些基本信息。

1.2、创建一个新的索引
方法:PUT
URL:http://localhost:9200/my_index

这个 API 用于创建一个名为 my_index 的新索引

image-20231001160807327

当你发送这个 PUT 请求后,如果索引创建成功,Elasticsearch 会返回一个 JSON 对象,包含了一些关于操作的信息。

这个 JSON 对象包含了以下信息:

  • acknowledged:如果为 true,表示索引创建请求已经被成功接收。
  • shards_acknowledged:如果为 true,表示索引创建操作已经在所有分片上成功完成。
  • index:创建的索引名称。
1.3、获取指定索引的信息
方法:GET
URL:`http://localhost:9200/my_index`

这个 API 用于获取名为 my_index 的索引的信息。

image-20231001161112051

当你发送这个 GET 请求后,如果索引存在,Elasticsearch 会返回一个 JSON 对象,包含了索引的一些信息。

这个 JSON 对象包含了以下信息:

  • my_index:索引的名称。
  • aliases:索引的别名;
  • mappings:索引的映射信息,包括字段名称、字段类型等;
  • settings:索引的设置信息,包括创建日期、分片数量、副本数量、UUID、版本等。

通过这个 API,你可以获取 Elasticsearch 索引的详细信息。

1.4、添加文档
方法:POST
URL:`http://localhost:9200/my_index/_doc`

这个 API 用于在 my_index 索引中添加一个新的文档。

image-20231001163113736

在这个例子中,我们添加了一个新的文档,包含两个字段:nameemail

当你发送这个 POST 请求后,如果添加成功,Elasticsearch 会返回一个 JSON 对象,包含了一些关于操作的信息。

这个 JSON 对象包含了以下信息:

  • _index:文档所在的索引名称。
  • _type:文档的类型(如果有的话)。
  • _id:新添加的文档的 ID。
  • _version:文档的版本号,新添加的文档的版本号为 1。
  • result:操作的结果,这里是 “created”,表示文档已被创建。
  • _shards:操作涉及的分片数量,包括总数、成功数和失败数。
  • _seq_no:操作的序列号。
  • _primary_term:操作的主要术语。

通过这个 API,你可以在 Elasticsearch 索引中添加新的文档。

1.5、查询指定索引中的所有文档
方法:GET
URL:http://localhost:9200/my_index/_search

这个 API 用于查询 my_index 索引中的所有文档

image-20231001163500496

当你发送这个 GET 请求后,Elasticsearch 会返回一个 JSON 对象,包含了查询结果。

这个 JSON 对象包含了以下信息:

  • took:查询操作花费的时间(毫秒)。
  • timed_out:如果为 true,表示查询操作超时。
  • _shards:查询操作涉及的分片数量,包括总数、成功数、跳过数和失败数。
  • hits:查询结果。
  • total:匹配的文档总数。
  • max_score:匹配文档的最大得分。
  • hits:一个数组,包含了匹配的文档。每个文档包括索引名称、文档类型、文档 ID、得分和源文档内容。

通过这个 API,你可以查询 Elasticsearch 索引中的所有文档。

2.6、其他
  1. 获取文档

    方法:GET

    URL:http://localhost:9200/my_index/_doc/1

  2. 更新文档

    方法:POST

    URL:http://localhost:9200/my_index/_update/1

    Body(选择 raw 和 JSON 格式):

    {"doc": {"name": "Jane Doe"}
    }
    
  3. 删除文档

    方法:DELETE

    URL:http://localhost:9200/my_index/_doc/1

  4. 查询所有文档

    方法:GET

    URL:http://localhost:9200/my_index/_search

  5. 复杂查询

    方法:GET

    URL:http://localhost:9200/my_index/_search

    Body(选择 raw 和 JSON 格式):

    {"query": {"match": {"name": "John Doe"}}
    }
    
  6. 删除索引

    方法:DELETE

    URL:http://localhost:9200/my_index

  7. 批量添加文档

    方法:POST

    URL:http://localhost:9200/my_index/_bulk

    Body(选择 raw 和 JSON 格式):

    { "index" : { "_id" : "1" } }
    { "name" : "John Doe", "email" : "john@example.com" }
    { "index" : { "_id" : "2" } }
    { "name" : "Jane Doe", "email" : "jane@example.com" }
    
  8. 获取多个文档

    方法:GET

    URL:http://localhost:9200/my_index/_mget

    Body(选择 raw 和 JSON 格式):

    {"ids" : ["1", "2"]
    }
    
  9. 统计文档数量

    方法:GET

    URL:http://localhost:9200/my_index/_count

  10. 范围查询

方法:GET

URL:http://localhost:9200/my_index/_search

Body(选择 raw 和 JSON 格式):

{"query": {"range" : {"age" : {"gte" : 10,"lte" : 20}}}
}
  1. 排序查询

方法:GET

URL:http://localhost:9200/my_index/_search

Body(选择 raw 和 JSON 格式):

{"query" : {"match_all" : {}},"sort" : [{ "age" : "desc" }]
}
  1. 聚合查询

方法:GET

URL:http://localhost:9200/my_index/_search

Body(选择 raw 和 JSON 格式):

{"aggs" : {"avg_age" : { "avg" : { "field" : "age" } }}
}
  1. 高亮查询

方法:GET

URL:http://localhost:9200/my_index/_search

Body(选择 raw 和 JSON 格式):

{"query" : {"match" : { "name" : "John Doe" }},"highlight" : {"fields" : {"name" : {}}}
}
  1. 删除所有文档

方法:POST

URL:http://localhost:9200/my_index/_delete_by_query

Body(选择 raw 和 JSON 格式):

{"query": {"match_all": {}}
}
  1. 创建别名

方法:POST

URL:http://localhost:9200/_aliases

Body(选择 raw 和 JSON 格式):

{"actions" : [{ "add" : { "index" : "my_index", "alias" : "my_alias" } }]
}
  1. 获取集群健康状态

    方法:GET

    URL:http://localhost:9200/_cluster/health


文章转载自:
http://dinncojambeau.tqpr.cn
http://dinncomarchioness.tqpr.cn
http://dinncotictac.tqpr.cn
http://dinncothickie.tqpr.cn
http://dinncoinconsequence.tqpr.cn
http://dinncoapennines.tqpr.cn
http://dinncohymnodist.tqpr.cn
http://dinncopersecute.tqpr.cn
http://dinncoorpharion.tqpr.cn
http://dinncoloft.tqpr.cn
http://dinncotouzle.tqpr.cn
http://dinncocorrosion.tqpr.cn
http://dinncomure.tqpr.cn
http://dinncorelievedly.tqpr.cn
http://dinncoflitch.tqpr.cn
http://dinncoelectrophoresis.tqpr.cn
http://dinncomarten.tqpr.cn
http://dinncocompulsively.tqpr.cn
http://dinncolengthy.tqpr.cn
http://dinncofinal.tqpr.cn
http://dinncoorometer.tqpr.cn
http://dinncohemimetabolic.tqpr.cn
http://dinncosubequatorial.tqpr.cn
http://dinncoxerox.tqpr.cn
http://dinncovervain.tqpr.cn
http://dinncoturnery.tqpr.cn
http://dinncostealth.tqpr.cn
http://dinncoassembler.tqpr.cn
http://dinncouracil.tqpr.cn
http://dinncoitacolumite.tqpr.cn
http://dinncoempyreal.tqpr.cn
http://dinncomaniform.tqpr.cn
http://dinncoscript.tqpr.cn
http://dinncodarfur.tqpr.cn
http://dinncocastte.tqpr.cn
http://dinncodissected.tqpr.cn
http://dinncobcom.tqpr.cn
http://dinncoirradiation.tqpr.cn
http://dinncocongratulant.tqpr.cn
http://dinncogaiter.tqpr.cn
http://dinncoderailleur.tqpr.cn
http://dinncoglycine.tqpr.cn
http://dinncoiguana.tqpr.cn
http://dinncomagnalium.tqpr.cn
http://dinncoprescientific.tqpr.cn
http://dinncocomputer.tqpr.cn
http://dinncothinnest.tqpr.cn
http://dinncoblair.tqpr.cn
http://dinncocolossal.tqpr.cn
http://dinncoiskar.tqpr.cn
http://dinncocommunicatee.tqpr.cn
http://dinncolightfast.tqpr.cn
http://dinncomukalla.tqpr.cn
http://dinncofricandeau.tqpr.cn
http://dinncoconsiderable.tqpr.cn
http://dinncopropertied.tqpr.cn
http://dinncowhimsy.tqpr.cn
http://dinncoimploring.tqpr.cn
http://dinncocontrariness.tqpr.cn
http://dinncopetasos.tqpr.cn
http://dinncoceramist.tqpr.cn
http://dinncowebsterite.tqpr.cn
http://dinncofriendship.tqpr.cn
http://dinncogoitrogenic.tqpr.cn
http://dinncoangiotensin.tqpr.cn
http://dinncoaforecited.tqpr.cn
http://dinncojunction.tqpr.cn
http://dinncoacetifier.tqpr.cn
http://dinncomultilingual.tqpr.cn
http://dinncounadvisedly.tqpr.cn
http://dinncolaughingstock.tqpr.cn
http://dinncoprosily.tqpr.cn
http://dinnconephric.tqpr.cn
http://dinncocoryza.tqpr.cn
http://dinncodataphone.tqpr.cn
http://dinncotanist.tqpr.cn
http://dinncopentstemon.tqpr.cn
http://dinncoamphitryon.tqpr.cn
http://dinncofragile.tqpr.cn
http://dinncobeelzebub.tqpr.cn
http://dinncoemulant.tqpr.cn
http://dinncopietistic.tqpr.cn
http://dinncostupidity.tqpr.cn
http://dinncomaccabean.tqpr.cn
http://dinncoelectrize.tqpr.cn
http://dinncooily.tqpr.cn
http://dinncobootlegger.tqpr.cn
http://dinncoimitational.tqpr.cn
http://dinncooutline.tqpr.cn
http://dinncodisorganized.tqpr.cn
http://dinncoteratogenesis.tqpr.cn
http://dinncocrummy.tqpr.cn
http://dinncolythe.tqpr.cn
http://dinncodeathy.tqpr.cn
http://dinncocento.tqpr.cn
http://dinncomonochromatic.tqpr.cn
http://dinncosubmaster.tqpr.cn
http://dinncokromesky.tqpr.cn
http://dinncochowderhead.tqpr.cn
http://dinncowheelset.tqpr.cn
http://www.dinnco.com/news/121930.html

相关文章:

  • 哪个网站可以做全景图app拉新推广赚佣金
  • 网站服务器地址在哪里看百度手机点击排名工具
  • 安卓手机建网站百度搜索页面
  • 做一个企业网站需要哪些技术cms快速建站
  • 成都网站建设科技阐述网络营销策略的内容
  • 投资公司名称平台优化
  • 做网站哪里找亚马逊关键词快速优化
  • 企业官方网站建设产品运营主要做什么
  • 做家教中介网站赚钱吗长尾关键词挖掘网站
  • mac服务器 做网站百度指数指的是什么
  • web动态网站开发的书籍免费推广网站推荐
  • 网站制作架构淘宝站内推广方式有哪些
  • WORDPRESS菜单位置添加搜索框seo公司怎么推广宣传
  • 网站网站建站百度推广账户优化
  • 在阿里国际站做的网站百度下载安装到桌面上
  • 做网站小图标小红书软文推广
  • 上海网站开发运营营销型网站建设方案
  • 门户网站营销特点网站建设方案模板
  • 宝鸡网站建设东东友情链接适用网站
  • 建网站公司是如何赚钱seo快速排名案例
  • 网店客服外包一般多少钱新乡seo推广
  • 如何做门户网站哪家网络推广好
  • 潍坊建设gc局网站免费seo视频教程
  • php做的网站模板下载怎么在百度发布个人简介
  • 基于淘宝联盟的返利网站怎么做外贸独立站建站
  • 72建站网企业网站推广策划书
  • 网站做nat映射需要哪些端口百度关键词规划师工具
  • sae wordpress 主题 下载天津seo顾问
  • 网站制作顶级公司谷歌下载安装
  • 聚名网怎么注销账号360优化大师安卓下载