标签: elasticsearch-mapping

没有在字段[name]上声明的类型[string]的处理程序

type声明为string,Elasticsearch 6.0将显示此错误.

"name" => [
  "type" => "string",
  "analyzer" => "ik_max_word"
]
Run Code Online (Sandbox Code Playgroud)

elasticsearch elasticsearch-mapping elasticsearch-6

101
推荐指数
1
解决办法
4万
查看次数

在Elasticsearch中将字符串的默认映射更改为"未分析"

在我的系统中,数据的插入总是通过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 logstash logstash-grok elasticsearch-mapping

35
推荐指数
3
解决办法
4万
查看次数

在elasticsearch中存储日期格式

当我想在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

26
推荐指数
1
解决办法
5万
查看次数

边缘NGram与短语匹配

我需要自动完成短语.例如,当我搜索"alz痴呆症"时,我想得到"阿尔茨海默氏症的老年痴呆症".

为此,我配置了Edge NGram tokenizer.我在查询体中尝试了两个edge_ngram_analyzerstandard作为分析器.然而,当我试图匹配一个短语时,我无法得到结果.

我究竟做错了什么?

我的查询:

{
  "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 elasticsearch-mapping elasticsearch-query

9
推荐指数
2
解决办法
6099
查看次数

如何在Elasticsearch中进行字符串数组的映射

在尝试将映射映射到索引时,我找不到有关如何在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)

clojure elasticsearch elasticsearch-mapping elasticsearch-5

9
推荐指数
1
解决办法
1万
查看次数

Elasticsearch _timestamp

我试图_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)

我的映射有什么问题?

elasticsearch elasticsearch-mapping

8
推荐指数
1
解决办法
6346
查看次数

在elasticsearch中搜索字幕数据

有以下数据(简单的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在上面的示例中)。

我的想法是

  • 将 srt 文件索引为列表类型,时间戳是索引。我相信这不会匹配重叠多个键的短语
  • 创建仅索引文本部分的自定义标记器。我不确定elasticsearch 能在多大程度上突出显示原始内容。
  • 仅索引文本部分并将其映射回弹性搜索之外的时间戳

或者还有另一种选择可以优雅地解决这个问题吗?

elasticsearch elasticsearch-model elasticsearch-mapping elasticsearch-query

7
推荐指数
1
解决办法
411
查看次数

Elasticsearch Mapping - 重命名现有字段

无论如何我可以重命名现有的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)

bigdata elasticsearch elasticsearch-mapping

7
推荐指数
3
解决办法
8187
查看次数

完整的点路径(任何级别路径),在dynamic_templates中具有path_match

我有这个文件

{
    "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"一起使用吗?(就像我的例子一样)

问题2:

"path_match":"*.text_*"匹配整个路径"one.two.three.text_*"还是仅匹配“one.text_*”?

问题3:

也会"path_match":"*.text_*"匹配 root 属性吗"text_foo"

问题4:

如果唯一的解决方案是使用正则表达式 ( "match_pattern":"regex"),则正则表达式将匹配整个路径"one.two.three.text_bar"还是仅匹配"text_bar"

mapping elasticsearch elasticsearch-mapping elasticsearch-template

6
推荐指数
0
解决办法
674
查看次数

Elasticsearch映射-同一字段中的不同数据类型

我正在尝试创建一个映射,使我可以拥有一个如下所示的文档:

{
    "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。我可以使用吗?

elasticsearch elasticsearch-mapping

5
推荐指数
2
解决办法
4891
查看次数