我正在尝试在单节点集群中设置 ElasticSearch 7.3.1。
我尝试添加:
discovery.type: single-node
但后来我收到以下错误:
java.lang.IllegalStateException:当本地节点 {node-1}{O846-1yHRLiOGzLUx 4RycQ}{KKT2Ljj3QUWiFR4K1ICrDg}{127.0.0.1}{127.0.0.1:9300} 时,无法以 [discovery.type] 设置为 [单节点] 的方式启动{dim}{ml.machine_memory=17179262976, xpack.installed=true, ml.max_open_jobs=20} 在投票配置 VotingConfiguration 中没有法定人数
如果我删除该行discovery.type: single-node,则会出现以下错误:
master 尚未发现或选举,选举需要两个 ID 为 [O846-1yHRLiOGzLUx 4RycQ, j1tBqJEtSXO78j6Ym8OceA] 的节点,已发现 [{node-1}{O846-1yHRLiOGzLUx4RycQ}{KE4tPTGtS7ukT7k-6iLxaw}{127.0.0.1}{127.0.0.1 :9300}{dim}{ml.machine_memory=17179262976, xpack.installed=true, ml.max_open_jobs=20}] 这不是法定人数;发现将继续使用 [127.0.0.1:9301, 127.0.0.1:9302, 127.0.0.1:9303, 127.0.0.1:9304, 127.0.0.1:9305, [::1]:9 301, [::1]: 9302、[::1]:9303、[::1]:9304、[::1]:9305] 来自主机提供商和 [{node-1}{O846-1yHRLiOGzLUx4RycQ}{KE4tPTGtS7ukT7k-6iLxaw}{127.0.0.1 }{127.0.0.1:9300}{dim}{ml.machin e_memory=17179262976, xpack.installed=true, ml.max_open_jobs=20}] 来自最后已知的集群状态;节点术语 0,术语 0 中最后接受的版本 0
我正在尝试使用 docker-compose 运行 elasticsearch 7.6.0。我收到错误。
下面是 docker-compose.yml
version: '2.2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.0
container_name: elasticsearch-7
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- http.cors.enabled=true
- http.cors.allow-origin=*
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- "D:/docker2/elasticsearch/7/data:/usr/share/elasticsearch/data"
ports:
- 9200:9200
- 9300:9300
command: elasticsearch
Run Code Online (Sandbox Code Playgroud)
错误 :
elasticsearch-7 | ERROR: [1] bootstrap checks failed
elasticsearch-7 | [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
elasticsearch-7 | {"type": "server", "timestamp": "2020-02-13T14:42:51,223Z", …Run Code Online (Sandbox Code Playgroud) 我有3个节点的elasticsearch集群。如果多个节点出现故障,我可以轻松地手动检查它们。假设集群中的节点增加了,那么手动检查它们将变得困难。那么,即使集群已关闭,我怎样才能获取集群的所有节点(特别是节点名称)呢?
为了获得活动/健康的节点,我点击了 api 端点:
curl -X GET "hostname/ip:port/_cat/nodes?v&pretty"
是否有任何端点可以用来获取elasticsearch集群中的总节点数和不健康/关闭的节点数?
我试图列出使用配置文件discovery.seed.hosts中存在的所有节点elasticsearch.yml。但我不知道该怎么做,也不知道这是正确的方法还是不正确。
我在按照此处的指南设置 search_as_you_type 字段并突出显示时遇到问题https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-as-you-type.html
我将留下一系列命令来重现我所看到的内容。希望有人能权衡我所缺少的:)
PUT /test_index
{
"mappings": {
"properties": {
"plain_text": {
"type": "search_as_you_type",
"index_options": "offsets",
"term_vector": "with_positions_offsets"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
POST /test_index/_doc
{
"plain_text": "This is some random text"
}
Run Code Online (Sandbox Code Playgroud)
GET /snippets_test/_search
{
"query": {
"multi_match": {
"query": "rand",
"type": "bool_prefix",
"fields": [
"plain_text",
"plain_text._2gram",
"plain_text._3gram",
"plain_text._index_prefix"
]
}
},
"highlight" : {
"fields" : [
{
"plain_text": {
"number_of_fragments": 1,
"no_match_size": 100
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
{
"took" : 1, …Run Code Online (Sandbox Code Playgroud) 我编写了以下函数并得到如下所示的响应:
public async Task<GetMappingResponse> ShowMapping(string indexname)
{
var result =await _client.Indices.GetMappingAsync(new GetMappingRequest(indexname));
return result;
}
Run Code Online (Sandbox Code Playgroud)
回复:
{
"apiCall": {
"auditTrail": [
{
"event": 5,
"node": {
"clientNode": false,
......
......
"name": null,
"settings": {},
"uri": "http://localhost:9200/"
},
"path": "pure/_mapping",
"ended": "2020-01-22T11:25:48.2324298Z",
"started": "2020-01-22T11:25:47.836833Z",
"exception": null
}
],
"debugInformation": "Successful (200) low level call on GET: /pure/_mapping\r\n# Audit trail of this API call:\r\n - [1] PingSuccess: Node: http://localhost:9200/ Took: 00:00:00.1716082\r\n - [2] HealthyResponse: Node: http://localhost:9200/ Took: 00:00:00.3955968\r\n# Request:\r\n<Request stream not captured …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我们的一台远程服务器上配置 Elastic Search。我已经使用 .msi 安装文件 (v7.1.1) 安装了它,并为 9200 和 9300 端口配置了防火墙。
当我设置network.publish_host服务器 ip 时,它给了我这个错误the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured。然后我做了一些研究并设置cluster.initial_master_nodes为名为“ElasticSearchNode”的单个节点。现在服务正在运行,但是当我检查集群运行状况时,它显示“master_not_discovered_exception”。
我当前的 yml 文件如下所示:
bootstrap.memory_lock: false
cluster.name: elasticsearch
http.port: 9200
node.data: true
node.ingest: true
node.master: true
node.max_local_storage_nodes: 1
node.name: ElasticSearchNode
path.data: C:\ProgramData\Elastic\Elasticsearch\data
path.logs: C:\ProgramData\Elastic\Elasticsearch\logs
transport.tcp.port: 9300
xpack.license.self_generated.type: basic
xpack.security.enabled: false
network.host: 0.0.0.0
network.publish_host: x.x.x.x
cluster.initial_master_nodes: ElasticSearchNode
discovery.zen.minimum_master_nodes: 1
Run Code Online (Sandbox Code Playgroud)
我请求 /_cat/health?v 时的响应
{"error":{"root_cause":[{"type":"master_not_discovered_exception","reason":null}],"type":"master_not_discovered_exception","reason":null},"status":503}
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激。
我是“弹性搜索”的新手,目前正在尝试了解 ES 如何维持“父子”关系。我从以下文章开始:
https://www.elastic.co/blog/managing-relations-inside-elasticsearch
但是这篇文章基于旧版本的 ES,我目前使用的是 ES 7.5,其中指出:
_parent 字段已被移除,取而代之的是 join 字段。
现在我正在关注这篇文章:
https://www.elastic.co/guide/en/elasticsearch/reference/7.5/parent-join.html
但是,我无法获得所需的结果。
我有一个场景,其中我有两个索引“人”和“家”。每个“人”可以有多个“家”,这基本上是一对多的关系。问题是当我查询获取所有父母为“XYZ”人的房屋时,答案为空。
以下是我的索引结构和搜索查询:
{
"mappings": {
"properties": {
"name": {
"type": "text"
},
"person_home": {
"type": "join",
"relations": {
"person": "home"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
请求地址:http://hostname/home
{
"mappings": {
"properties": {
"state": {
"type": "text"
},
"person_home": {
"type": "join",
"relations": {
"person": "home"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
请求网址:http://hostname/person/_doc/1
{
"name": "shujaat",
"person_home": …Run Code Online (Sandbox Code Playgroud) 我正在努力解决 ElasticSearch 7 中的一个新问题。尝试在 Nest 库 C# 中使用自动映射创建索引时,出现“总字段限制”错误。
await _elasticContext.GetClient().Indices.CreateAsync(indexName, c => c
.Map<DocumentWrapper>(m => m.AutoMap()));
Run Code Online (Sandbox Code Playgroud)
问题是如何将 集成index.mapping.total_fields.limit到上面的查询中?或者替代解决方案(如果有的话)?
谢谢
我对弹性搜索中选定索引的文档计数有点困惑,下面是索引的片段
GET /_cat/indices/zipkin-span-2020-07-30?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open zipkin-span-2020-07-30 STcY29kkT3W7Y0XybbfVTQ 1 1 264996 0 88.9mb 88.9mb
Run Code Online (Sandbox Code Playgroud)
它显示文档计数为 264996,而当我点击以下请求时,它显示的记录很少(最多 20 条记录)
GET /zipkin-span-2020-07-30/_search
{"took":774,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},
"hits":{"total":{"value":10000,"relation":"gte"},"max_score":1.0,"hits":[{.... records.....}]}}
Run Code Online (Sandbox Code Playgroud)
注意 - 我也尝试过使用滚动 api,但仍然显示相同的输出。问题 -