我正在尝试对具有属性值对的弹性搜索索引文档。示例文件:
{
id: 1,
name: "metamorphosis",
author: "franz kafka"
}
{
id: 2,
name: "techcorp laptop model x",
type: "computer",
memorygb: 4
}
{
id: 3,
name: "ss2014 formal shoe x",
color: "black",
size: 42,
price: 124.99
}
Run Code Online (Sandbox Code Playgroud)
然后,我需要以下查询:
1. "author" EQUALS "franz kafka"
2. "type" EQUALS "computer" AND "memorygb" GREATER THAN 4
3. "color" EQUALS "black" OR ("size" EQUALS 42 AND price LESS THAN 200.00)
Run Code Online (Sandbox Code Playgroud)
存储这些文档以有效查询它们的最佳方法是什么?是否应该完全按照示例所示存储它们?或者我应该像这样存储它们:
{
fields: [
{ "type": "computer" },
{ "memorygb": 4 }
]
} …Run Code Online (Sandbox Code Playgroud) 我已经为我的fluentd.*索引设置了一个简单的 ILM 策略,在(用于测试 - )一小段时间后将被删除。
工业光魔:
PUT _ilm/policy/fluentd
{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"rollover": {
"max_age": "1d",
"max_size": "1gb"
},
"set_priority": {
"priority": 100
}
}
},
"delete": {
"min_age": "4d",
"actions": {
"delete": {}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
索引模板:
PUT _template/fluentd
{
"order": 0,
"index_patterns": [
"fluentd.*"
],
"settings": {
"index": {
"lifecycle": {
"name": "fluentd"
}
}
},
"aliases": {
"fluent": {}
}
}
Run Code Online (Sandbox Code Playgroud)
通过这些设置,我预计 ES 会删除超过 5-6 天的索引,但 …
我使用 Elasticsearch 和 Kibana 作为插件来查看索引中的数据。我正在使用 Kibana 的 DevTools 发送用于添加/删除/更新索引等的命令。
我想向某个文本属性添加一个字段,以便它具有一个关键字字段,以便能够使用此属性进行全文搜索和聚合。
1) 这样的更改是否意味着我也需要更新 Kibana 的索引模式?
2)我已经阅读了 ElasticSearch 的文档PUT Mappings并知道如何使用它来更新索引本身,但我不知道如何更新索引模式..我读过应该使用相同的 API 来更新它,但我不知道不知道如何查看索引模式的原始映射以更新它。
我试图在弹性搜索中创建一个映射,以忽略我的传入数据中的一个字段.我在这里关注文档
https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-object-type.html#_enabled_3
看起来启用属性正是我需要的,但我没有得到预期的结果.
这是我的映射
PUT /comtest
{
"mappings": {
"ftype": {
"properties": {
"a": {
"type": "string"
},
"b": {
"type": "long"
},
"c":
{
"type" : "object",
"enabled" : false
},
"d": {
"type": "string"
},
"e": {
"type": "string"
},
"f": {
"type": "boolean"
},
"g": {
"type": "string"
},
"h": {
"type": "string"
},
"i": {
"type": "long"
},
"j": {
"type": "string"
},
"k": {
"type": "long"
},
"l": {
"type": "date"
},
"m": {
"type": …Run Code Online (Sandbox Code Playgroud)