2016-05-09 3 views
0

я быть_наст удалить отображение с ЦМДОМ«Индекс»: «not_analyzed» в elasticsearch

curl -XDELETE 'http://localhost:9200/logstash_log*/' 

в моем конфе, я определил индекс как следовать,

output { 
    elasticsearch { 
    hosts => localhost 
    index => "logstash_log-%{+YYYY.MM.dd}" 
} 

и попытаться создать новое отображение, но я получил ошибку

#curl -XPUT http://localhost:9200/logstash_log*/_mapping/log -d ' 

{ 


    "properties":{ 
      "@timestamp":"type":"date","format":"strict_date_optional_time||epoch_millis"}, 
      "message":{"type":"string"}, 
      "host":{"type":"ip"}, 
      "name":{"type":"string","index": "not_analyzed"}, 
      "type":{"type":"string"} 
       } 

}' 

{ "ошибка": { "ROOT_CAUSE": [{ "типа ":" index_not_found_exception "," reason ":" no такой индекс "," resource.type ":" index_or_alias "," resource.id ":" logstash_log * "," index ":" logstash_log * "}]," type ":" index_not_found_exception "," reason ":" no такой индекс "," resource.type ":" index_or_alias "," resource.id ":" logstash_log * "," index ":" logstash_log * "}," status " : 404}

Как это исправить? любая помощь будет оценена!

ответ

0

Вам необходимо повторно создать свой индекс так:

# curl -XPUT http://localhost:9200/logstash_log -d '{ 
    "mappings": { 
    "log": { 
     "properties": { 
     "@timestamp": { 
      "type": "date", 
      "format": "strict_date_optional_time||epoch_millis" 
     }, 
     "message": { 
      "type": "string" 
     }, 
     "host": { 
      "type": "ip" 
     }, 
     "name": { 
      "type": "string", 
      "index": "not_analyzed" 
     }, 
     "type": { 
      "type": "string" 
     } 
     } 
    } 
    } 
}' 

Хотя, так как это выглядит, как вы создаете ежедневные индексы из logstash, вы, вероятно, лучше создать шаблон вместо. Храните следующее содержимое внутри index_template.json

{ 
    "template": "logstash-*", 
    "mappings": { 
    "log": { 
     "properties": { 
     "@timestamp": { 
      "type": "date", 
      "format": "strict_date_optional_time||epoch_millis" 
     }, 
     "message": { 
      "type": "string" 
     }, 
     "host": { 
      "type": "ip" 
     }, 
     "name": { 
      "type": "string", 
      "index": "not_analyzed" 
     }, 
     "type": { 
      "type": "string" 
     } 
     } 
    } 
    } 
} 

А затем изменить конфигурацию logstash следующим образом:

output { 
    elasticsearch { 
    hosts => localhost 
    index => "logstash_log-%{+YYYY.MM.dd}" 
    manage_template => true 
    template_name => "logstash" 
    template => "/path/to/index_template.json" 
    template_overwrite => true 
} 
+0

@stefansaye удачи с этим? – Val

0

* это неверный символ для имени индекса.

Имя индекса не должно содержать следующие символы: [\, /, *, \», <,>, |?,,]