简体   繁体   English

弹性搜索未使用logstash中的已定义模板进行映射

[英]Defined Template from logstash not being used by elastic search for mapping

I have the following logstash output config to go into elasticsearch from a postgres database 我有以下logstash输出配置,可从postgres数据库进入elasticsearch

https://pastebin.com/BFCH3tuZ https://pastebin.com/BFCH3tuZ

I have defined the location and my template as the following: 我将位置和模板定义如下:

https://pastebin.com/mK5qshKM https://pastebin.com/mK5qshKM

When I run logstash I see the output as follows: 当我运行logstash时,我看到的输出如下:

[2017-05-24T20:54:10,828][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://localhost:9200/, :path=>"/"}
[2017-05-24T20:54:10,982][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>#<URI::HTTP:0xff97ab URL:http://localhost:9200/>}
[2017-05-24T20:54:10,985][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>"/etc/logstash/universe_template.json"}
[2017-05-24T20:54:11,045][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=>{"template"=>"universe_elastic", "settings"=>{"analysis"=>{"filter"=>{"gr$
[2017-05-24T20:54:11,052][INFO ][logstash.outputs.elasticsearch] Installing elasticsearch template to _template/universe_elastic
[2017-05-24T20:54:11,145][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>[#<URI::Generic:0xe60519 URL://localhost:9200$
[2017-05-24T20:54:11,154][INFO ][logstash.pipeline        ] Starting pipeline {"id"=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inf$
[2017-05-24T20:54:11,988][INFO ][logstash.pipeline        ] Pipeline main started
[2017-05-24T20:54:12,079][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
[2017-05-24T20:54:12,108][INFO ][logstash.inputs.jdbc     ] (0.101000s) select planet.id, planet.x || ':' || planet.y || ':' || planet.z coords, planet.x, planet.y, planet.z ,planetname,ru$
[2017-05-24T20:54:15,006][WARN ][logstash.agent           ] stopping pipeline {:id=>"main"}

When I query elasticseach templates I can see my template listed at: 当我查询elasticseach模板时,我可以在以下位置看到我的模板:

http://xxxx:9200/_template/ {   "universe_elastic": {
    "order": 0,
    "template": "universe_elastic",
    "settings": {
      "index": {
        "analysis": {
          "filter": {
            "gramFilter": {
              "token_chars": [
                "letter",
                "digit",
                "punctuation",
                "symbol"
              ], ETC ETC ETC......

However when I run a check on my "universe" index the mapping haven't come through: 但是,当我对“ Universe”索引进行检查时,映射尚未通过:

https://pastebin.com/hw9hYfLn https://pastebin.com/hw9hYfLn

I would expect to see the _all field and the include in all references set to true/false. 我希望看到_all字段以及所有引用中的include都设置为true / false。 But nothing.. Also the queries do not then use the analyzers I have specified. 但是什么也没有。.而且查询也不会使用我指定的分析器。

Any ideas what might be going wrong here? 有什么想法可能出什么问题吗? I have deleted out all the other possible templates created as well as re-created indexes etc. 我删除了所有其他可能创建的模板以及重新创建的索引等。

You've done it almost all correctly, you just need to change a single thing: 您几乎正确地完成了所有操作,只需更改一项即可:

In your template, this line 在您的模板中,此行

  "template": "universe_elastic",

should read 应该读

  "template": "universe",

ES is going to apply the apply only if your index name matches with the template name. ES仅在您的索引名称与模板名称匹配时才应用Apply。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM