2017-10-13 20 views
0

我是的新手,使用logstash-jdbc-input将数据从mysql加载到elasticsearch服务器。这里是logstash配置如何在elasticsearch中使用stopwords分析器

input { 
    jdbc { 
     jdbc_connection_string => "jdbc:mysql://localhost:3306/news" 
     jdbc_user => "root" 
     jdbc_password => "sunilgarg" 
     jdbc_validate_connection => true 
     jdbc_driver_library => "../jars/mysql-connector-java-5.1.21.jar" 
     jdbc_driver_class => "com.mysql.jdbc.Driver" 
     statement => "SELECT * from news" 
    } 
} 
output { 
    stdout {codec => json_lines} 
    elasticsearch { 
     "index" => "news" 
     "document_type" => "news" 
     "hosts" => "localhost:9200" 
     "document_id" => "%{id}" 
    } 
} 

将所有数据从数据库放到elasticsearch服务器后。我通过关闭索引更新分析仪的设置,然后更新使用PUT

{ 
    "settings": { 
    "analysis": { 
     "analyzer": { 
     "my_english_analyzer": { 
      "type": "standard", 
      "max_token_length": 5, 
      "stopwords": "_english_" 
     } 
     } 
    } 
    } 
} 

打开再次使用/news/_openPOST请求指数后的分析,我仍然可以搜索使用停用词一样的,就是等。

问题是什么?难道我做错了什么?

+0

您错过了使用此分析仪设置哪个字段。在您的映射模板或您的自定义映射中,您应该设置字段的分析属性。 – hkulekci

回答

0

分析器在索引时间应用。您应该先定义您的映射,然后索引您的文档。

相关问题