当type声明为string,Elasticsearch 6.0将显示此错误.
"name" => [
"type" => "string",
"analyzer" => "ik_max_word"
]
Run Code Online (Sandbox Code Playgroud) 在我的系统中,数据的插入总是通过logstash通过csv文件完成.我从未预先定义映射.但每当我输入一个字符串,它总是被认为是analyzed,作为结果的条目一样hello I am Sinha被分为hello,I,am,Sinha.无论如何我可以更改elasticsearch的默认/动态映射,以便所有字符串,无论索引如何,无论类型如何都被认为是not analyzed?或者有没有办法在.conf文件中设置它?说我的conf文件看起来像
input {
file {
path => "/home/sagnik/work/logstash-1.4.2/bin/promosms_dec15.csv"
type => "promosms_dec15"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
csv {
columns => ["Comm_Plan","Queue_Booking","Order_Reference","Multi_Ordertype"]
separator => ","
}
ruby {
code => "event['Generation_Date'] = Date.parse(event['Generation_Date']);"
}
}
output {
elasticsearch {
action => "index"
host => "localhost"
index => "promosms-%{+dd.MM.YYYY}"
workers => 1
}
}
Run Code Online (Sandbox Code Playgroud)
我想要所有的字符串 …
当我想在Elasticsearch中添加一个日期时间字符串时遇到了问题.
该文件如下:
{"LastUpdate" : "2013/07/24 00:00:00"}
Run Code Online (Sandbox Code Playgroud)
该文件引发了一个错误 "NumberFormatException" [For input string: \"20130724 00:00:00\"]
我知道我可以在Elasticsearch中使用日期格式,但即使我在网站上阅读该文档,我也不知道如何使用.
{"LastUpdate": {
"properties": {
"type": "date",
"format": "yyyy-MM-dd"}
}
}
Run Code Online (Sandbox Code Playgroud)
和
{"LastUpdate": {
"type": "date",
"format": "yyyy-MM-dd"
}
}
Run Code Online (Sandbox Code Playgroud)
错了.
如何在Elasticsearch中将日期时间字符串转换为日期格式?
如何将日期时间字符串直接存储到Elasticsearch中?
datetime datetime-format elasticsearch elasticsearch-mapping
我需要自动完成短语.例如,当我搜索"alz痴呆症"时,我想得到"阿尔茨海默氏症的老年痴呆症".
为此,我配置了Edge NGram tokenizer.我在查询体中尝试了两个edge_ngram_analyzer并standard作为分析器.然而,当我试图匹配一个短语时,我无法得到结果.
我究竟做错了什么?
我的查询:
{
"query":{
"multi_match":{
"query":"dementia in alz",
"type":"phrase",
"analyzer":"edge_ngram_analyzer",
"fields":["_all"]
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的映射:
...
"type" : {
"_all" : {
"analyzer" : "edge_ngram_analyzer",
"search_analyzer" : "standard"
},
"properties" : {
"field" : {
"type" : "string",
"analyzer" : "edge_ngram_analyzer",
"search_analyzer" : "standard"
},
...
"settings" : {
...
"analysis" : {
"filter" : {
"stem_possessive_filter" : {
"name" : "possessive_english",
"type" : …Run Code Online (Sandbox Code Playgroud) 在尝试将映射映射到索引时,我找不到有关如何在elasticsearch中构造字符串数组的任何示例.
我有什么用于字段映射:
:tags {:type :array :store true}
我得到的错误:
{:type "mapper_parsing_exception",
:reason "No handler for type [array] declared on field [tags]"}
Run Code Online (Sandbox Code Playgroud) 我试图_timestamp在索引上定义属性.首先,我创建索引
curl -XPUT 'http://elasticsearch:9200/ppe/'
来自服务器的响应: {"ok":true,"acknowledged":true}
然后我尝试用a定义映射 _timestamp
curl -Xput 'http://elasticsearch:9200/ppe/log/_mapping' -d '{
"log": {
"properties": {
"_ttl": {
"enabled": true
},
"_timestamp": {
"enabled": true,
"store": "yes"
},
"message": {
"type": "string",
"store": "yes"
},
"appid": {
"type": "string",
"store": "yes"
},
"level": {
"type": "integer",
"store": "yes"
},
"logdate": {
"type": "date",
"format": "date_time_no_millis",
"store": "yes"
}
}
}
}'
Run Code Online (Sandbox Code Playgroud)
我收到服务器的答复
{
"error": "MapperParsingException[No type specified for property [_timestamp]]",
"status": 400
}
Run Code Online (Sandbox Code Playgroud)
我的映射有什么问题?
有以下数据(简单的srt)
1
00:02:17,440 --> 00:02:20,375
Senator, we're making our final
2
00:02:20,476 --> 00:02:22,501
approach into Coruscant.
...
Run Code Online (Sandbox Code Playgroud)
在 Elasticsearch 中索引它的最佳方法是什么?现在有一个问题:我希望搜索结果突出显示链接到时间戳指示的确切时间。此外,还有多个 srt 行重叠的短语(例如final approach在上面的示例中)。
我的想法是
或者还有另一种选择可以优雅地解决这个问题吗?
elasticsearch elasticsearch-model elasticsearch-mapping elasticsearch-query
无论如何我可以重命名现有的elasticsearch映射中的元素而无需添加新元素吗?如果是这样,为了避免破坏现有的映射,最好的方法是什么?
例如,从fieldCamelcase到fieldCamelCase
{
"myType": {
"properties": {
"timestamp": {
"type": "date",
"format": "date_optional_time"
},
"fieldCamelcase": {
"type": "string",
"index": "not_analyzed"
},
"field_test": {
"type": "double"
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 我有这个文件
{
"text_foo": "lorem ipsum",
"one":{
"two":{
"three":{
"text_bar": "dolor sit amet"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我想要完成的事情:我需要动态模板,它将匹配以“text_”开头的任何属性示例:
"mappings" : {
"dynamic_templates":[
{
"text":{
"match": "text_*",
"path_match": "*.text_*",
"match_mapping_type": "*",
"mapping":{"type":"text","analyzer":"myCustomAnalyzer"}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
"match"和可以"path_match"一起使用吗?(就像我的例子一样)
会"path_match":"*.text_*"匹配整个路径"one.two.three.text_*"还是仅匹配“one.text_*”?
也会"path_match":"*.text_*"匹配 root 属性吗"text_foo"?
如果唯一的解决方案是使用正则表达式 ( "match_pattern":"regex"),则正则表达式将匹配整个路径"one.two.three.text_bar"还是仅匹配"text_bar"?
mapping elasticsearch elasticsearch-mapping elasticsearch-template
我正在尝试创建一个映射,使我可以拥有一个如下所示的文档:
{
"created_at" : "2014-11-13T07:51:17+0000",
"updated_at" : "2014-11-14T12:31:17+0000",
"account_id" : 42,
"attributes" : [
{
"name" : "firstname",
"value" : "Morten",
"field_type" : "string"
},
{
"name" : "lastname",
"value" : "Hauberg",
"field_type" : "string"
},
{
"name" : "dob",
"value" : "1987-02-17T00:00:00+0000",
"field_type" : "datetime"
}
]
Run Code Online (Sandbox Code Playgroud)
}
而且attributes数组必须是嵌套的并且是动态的类型,因此我可以向数组中添加更多对象,并根据该field_type值对其进行索引。
这有可能吗?
我一直在看dynamic_templates。我可以使用吗?