elasticsearch,hunspell,Ruby On Rails,elasticsearch,Hunspell" /> elasticsearch,hunspell,Ruby On Rails,elasticsearch,Hunspell" />

Ruby on rails 创建索引(Rails)时的Elasticsearch问题

Ruby on rails 创建索引(Rails)时的Elasticsearch问题,ruby-on-rails,elasticsearch,hunspell,Ruby On Rails,elasticsearch,Hunspell,我在为我的产品模型类创建索引时遇到问题。这是因为我添加了拼写过滤器,无法找出错误所在 如果有任何提示,我将不胜感激 谢谢你,米罗斯拉夫 配置: settings index: { number_of_shards: 5, analysis: { filter: { trigrams_filter: { type: 'ngram', min_gram: 2, max_gram: 10 }, content_filter: {

我在为我的产品模型类创建索引时遇到问题。这是因为我添加了拼写过滤器,无法找出错误所在

如果有任何提示,我将不胜感激

谢谢你,米罗斯拉夫


配置:

settings index: {
number_of_shards: 5,
analysis: {
  filter: {
    trigrams_filter: {
      type: 'ngram',
      min_gram: 2,
      max_gram: 10
    },
    content_filter: {
      type: 'ngram',
      min_gram: 4,
      max_gram: 20
    },
    hunspell_CZ: {
      type: 'hunspell',
      locale: 'cs_CZ',
      dedup: true,
      recursion_level: 0
    },
    czechStemmer: {
      type: 'stemmer',
      name: 'czech'
    },
    customWordDelimiter: {
      type: 'word_delimiter',
      generate_word_parts: true,
      generate_number_parts: true,
      catenate_words: true,
      catenate_numbers: true,
      catenate_all: true,
      split_on_case_change: true,
      preserve_original: true,
      split_on_numerics: true,
      stem_english_possessive: false
    },
    customUnique: {
      type: 'unique',
      only_on_same_position: false
    }
  },
  analyzer: {
    myFulltextAnalyzer: {
      type: 'custom',
      tokenizer: 'standard',
      filter: ['lowercase', 'hunspell_CZ', 'icu_folding', 'customWordDelimiter', 'czechStemmer', 'customUnique'],
      char_filter: ['html_strip']
    },
    index_trigrams_analyzer: {
      type: 'custom',
      tokenizer: 'standard',
      filter: ['lowercase', 'trigrams_filter', 'asciifolding']
    },
    search_trigrams_analyzer: {
      type: 'custom',
      tokenizer: 'whitespace',
      filter: ['lowercase']
    },
    english: {
      tokenizer: 'standard',
      filter: ['standard', 'lowercase', 'content_filter']
    },
    czech: {
      tokenizer: 'standard',
      filter: ['asciifolding','standard','lowercase','content_filter']
    }
  }
}
} do
mappings dynamic: 'false' do
  indexes :id, type: 'integer'
  indexes :active, type: 'boolean'
  indexes :en_product, index_analyzer: 'myFulltextAnalyzer', search_analyzer: 'myFulltextAnalyzer'
  indexes :ma_product, index_analyzer: 'myFulltextAnalyzer', search_analyzer: 'myFulltextAnalyzer'
  indexes :cs_product, index_analyzer: 'myFulltextAnalyzer', search_analyzer: 'myFulltextAnalyzer'
  indexes :en_description, index_analyzer: 'myFulltextAnalyzer', search_analyzer: 'myFulltextAnalyzer'
  indexes :ma_description, index_analyzer: 'myFulltextAnalyzer', search_analyzer: 'myFulltextAnalyzer'
  indexes :cs_description, index_analyzer: 'myFulltextAnalyzer', search_analyzer: 'myFulltextAnalyzer'
  indexes :en_specification, index_analyzer: 'myFulltextAnalyzer', search_analyzer: 'myFulltextAnalyzer'
  indexes :ma_specification, index_analyzer: 'myFulltextAnalyzer', search_analyzer: 'myFulltextAnalyzer'
  indexes :cs_specification, index_analyzer: 'myFulltextAnalyzer', search_analyzer: 'myFulltextAnalyzer'
  indexes :manufacturer, index_analyzer: 'myFulltextAnalyzer', search_analyzer: 'myFulltextAnalyzer'
end
end
日志输出:

[2016-02-20 13:58:03,083][DEBUG][action.admin.indices.create] [db1] [products] failed to create
org.elasticsearch.indices.IndexCreationException: [products] failed to create index
    at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:338)
    at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$2.execute(MetaDataCreateIndexService.java:371)
    at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:374)
    at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:204)
    at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:167)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.elasticsearch.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalArgumentException: expected ']' at position 46
控制台输出:

2.2.0 :001 > Product.__elasticsearch__.create_index! force: true
2016-02-20 13:57:40 +0100: DELETE http://51.255.133.242:9200/products [status:404, request:0.010s, query:N/A]
2016-02-20 13:57:40 +0100: < {"error":"RemoteTransportException[[db1][inet[/10.250.0.30:9300]][indices:admin/delete]]; nested: IndexMissingException[[products] missing]; ","status":404}
2016-02-20 13:57:40 +0100: [404] {"error":"RemoteTransportException[[db1][inet[/10.250.0.30:9300]][indices:admin/delete]]; nested: IndexMissingException[[products] missing]; ","status":404}
[!!!] Index does not exist (Elasticsearch::Transport::Transport::Errors::NotFound)
2016-02-20 13:57:40 +0100: HEAD http://51.255.133.242:9200/products [status:404, request:0.006s, query:N/A]
2016-02-20 13:57:40 +0100: < 
2016-02-20 13:57:40 +0100: [404] 
2016-02-20 13:57:42 +0100: PUT http://51.255.133.242:9200/products [status:500, request:1.565s, query:N/A]
2016-02-20 13:57:42 +0100: > {"settings":{"index":{"number_of_shards":5,"analysis":{"filter":{"trigrams_filter":{"type":"ngram","min_gram":2,"max_gram":10},"content_filter":{"type":"ngram","min_gram":4,"max_gram":20},"hunspell_CZ":{"type":"hunspell","locale":"cs_CZ","dedup":true},"czechStemmer":{"type":"stemmer","name":"czech"},"customWordDelimiter":{"type":"word_delimiter","generate_word_parts":true,"generate_number_parts":true,"catenate_words":true,"catenate_numbers":true,"catenate_all":true,"split_on_case_change":true,"preserve_original":true,"split_on_numerics":true,"stem_english_possessive":false},"customUnique":{"type":"unique","only_on_same_position":false}},"analyzer":{"myFulltextAnalyzer":{"type":"custom","tokenizer":"standard","filter":["lowercase","hunspell_CZ","icu_folding","customWordDelimiter","czechStemmer","customUnique"],"char_filter":["html_strip"]},"index_trigrams_analyzer":{"type":"custom","tokenizer":"standard","filter":["lowercase","trigrams_filter","asciifolding"]},"search_trigrams_analyzer":{"type":"custom","tokenizer":"whitespace","filter":["lowercase"]},"english":{"tokenizer":"standard","filter":["standard","lowercase","content_filter"]},"czech":{"tokenizer":"standard","filter":["asciifolding","standard","lowercase","content_filter"]}}}}},"mappings":{"product":{"dynamic":"false","properties":{"id":{"type":"integer"},"active":{"type":"boolean"},"en_product":{"index_analyzer":"myFulltextAnalyzer","search_analyzer":"myFulltextAnalyzer","type":"string"},"ma_product":{"index_analyzer":"myFulltextAnalyzer","search_analyzer":"myFulltextAnalyzer","type":"string"},"cs_product":{"index_analyzer":"myFulltextAnalyzer","search_analyzer":"myFulltextAnalyzer","type":"string"},"en_description":{"index_analyzer":"myFulltextAnalyzer","search_analyzer":"myFulltextAnalyzer","type":"string"},"ma_description":{"index_analyzer":"myFulltextAnalyzer","search_analyzer":"myFulltextAnalyzer","type":"string"},"cs_description":{"index_analyzer":"myFulltextAnalyzer","search_analyzer":"myFulltextAnalyzer","type":"string"},"en_specification":{"index_analyzer":"myFulltextAnalyzer","search_analyzer":"myFulltextAnalyzer","type":"string"},"ma_specification":{"index_analyzer":"myFulltextAnalyzer","search_analyzer":"myFulltextAnalyzer","type":"string"},"cs_specification":{"index_analyzer":"myFulltextAnalyzer","search_analyzer":"myFulltextAnalyzer","type":"string"},"manufacturer":{"index_analyzer":"myFulltextAnalyzer","search_analyzer":"myFulltextAnalyzer","type":"string"}}}}}
 2016-02-20 13:57:42 +0100: < {"error":"RemoteTransportException[[db1][inet[/10.250.0.30:9300]][indices:admin/create]]; nested: IndexCreationException[[products] failed to create index]; nested: UncheckedExecutionException[java.lang.IllegalArgumentException: expected ']' at position 46]; nested: IllegalArgumentException[expected ']' at position 46]; ","status":500}
 2016-02-20 13:57:42 +0100: [500] {"error":"RemoteTransportException[[db1][inet[/10.250.0.30:9300]][indices:admin/create]]; nested: IndexCreationException[[products] failed to create index]; nested: UncheckedExecutionException[java.lang.IllegalArgumentException: expected ']' at position 46]; nested: IllegalArgumentException[expected ']' at position 46]; ","status":500}
Elasticsearch::Transport::Transport::Errors::InternalServerError: [500] {"error":"RemoteTransportException[[db1][inet[/10.250.0.30:9300]][indices:admin/create]]; nested: IndexCreationException[[products] failed to create index]; nested: UncheckedExecutionException[java.lang.IllegalArgumentException: expected ']' at position 46]; nested: IllegalArgumentException[expected ']' at position 46]; ","status":500}
from /opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/transport/base.rb:136:in `__raise_transport_error'
from /opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/transport/base.rb:228:in `perform_request'
from /opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
from /opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/client.rb:119:in `perform_request'
from /opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-api-1.0.13/lib/elasticsearch/api/namespace/common.rb:21:in `perform_request'
from /opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-api-1.0.13/lib/elasticsearch/api/actions/indices/create.rb:77:in `create'
from /opt/deploy/shared/bundle/ruby/2.2.0/bundler/gems/elasticsearch-rails-ded203569208/elasticsearch-model/lib/elasticsearch/model/indexing.rb:228:in `create_index!'
from (irb):1
from /opt/deploy/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/console.rb:110:in `start'
from /opt/deploy/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/console.rb:9:in `start'
from /opt/deploy/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:68:in `console'
from /opt/deploy/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /opt/deploy/shared/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
2.2.0:001>产品。弹性搜索。创建索引!原力:对
2016-02-20 13:57:40+0100:删除http://51.255.133.242:9200/products [状态:404,请求:0.010s,查询:不适用]
2016-02-20 13:57:40+0100:<{“错误”:“RemoteTransportException[[db1][inet[/10.250.0.30:9300]][index:admin/delete]];嵌套:IndexMissingeException[[products]missing];”,“状态”:404}
2016-02-20 13:57:40+0100:[404]{“错误”:“RemoteTransportException[[db1][inet[/10.250.0.30:9300]][index:admin/delete]];嵌套:IndexMissingeException[[products]missing];”,“状态”:404}
[!!!]索引不存在(Elasticsearch::Transport::Transport::Errors::NotFound)
2016-02-20 13:57:40+0100:头http://51.255.133.242:9200/products [状态:404,请求:0.006s,查询:不适用]
2016-02-20 13:57:40 +0100: < 
2016-02-20 13:57:40 +0100: [404] 
2016-02-20 13:57:42+0100:PUThttp://51.255.133.242:9200/products [状态:500,请求:1.565s,查询:不适用]
2016-02-20 13:57:42+0100:>{“设置”:{“索引”:{“碎片数”:5,“分析”:{“过滤器”:{“类型”:“ngram”,“min_gram”:2,“max_gram”:10},“内容过滤器”:{“类型”:“ngram”,“min_gram”:4,“max_gram”:20},“hunspell_CZ”:{“类型”:“Hunspect”:“hunspell”,“cs_CZ”,“Dudup”:true},“czechStemmer”:“type”:“捷克语”,“捷克语地区”:,“customWordDelimiter”:{“type”:“word_delimiter”,“generate_word_parts”:true,“generate_number_parts”:true,“catenate_words”:true,“catenate_all”:true,“split_on_case_change”:true,“preserve_original”:true,“split_on_on_numerics”:true,“stem_english_所有格”:false},“customUnique”:{“type”:“unique”,“only_on_on_on on_home_position”:false},”analyzer“{”myFulltextAnalyzer“{”类型“:”自定义“,”标记器“:”标准“,”过滤器“:[”小写“,”hunspell_CZ“,”icu折叠“,”customWordDelimiter“,”czechStemmer“,”customUnique“,”char_过滤器“:”[“html_strip”},“index_trigrams_analyzer“:{”类型“:”自定义“,”标记器“:”标准“,”过滤器“:”小写“,”trigrams_过滤器“,”搜索三角图分析器:{“类型”:“自定义”,“标记器”:“空白”,“过滤器”:[“小写”]},“英语”:{“标记器”:“标准”,“过滤器”:[“标准”,“小写”,“内容过滤器”]},“捷克”:{“标记器”:“标准”,“过滤器”:[“asciifolding”,“标准”,“小写”,“内容过滤器”]}}}},映射:{“产品”:{“动态”:“假”,“属性”:{“id”:{“类型”:整数“}”,活动“{”类型“:”布尔“}”,en_乘积“{”索引分析器“:”myFulltextAnalyzer“,”搜索分析器“:”myFulltextAnalyzer“,”类型“:”字符串“,”Mau乘积“{”索引分析器“:”myFulltextAnalyzer“,”搜索分析器“:”myFulltextAnalyzer“,”类型“:”字符串“,”cs_乘积“:{”索引分析器“:”myFulltextAnalyzer“,”搜索分析器“:”myFulltextAnalyzer“,”类型:““字符串”}”,en_描述:{“索引分析器”:“myFulltextAnalyzer”,“搜索分析器”:“myFulltextAnalyzer”,“类型:““字符串”}”,ma_描述:{“索引分析器”:“myFulltextAnalyzer”,“搜索分析器”:“myFulltextAnalyzer”,“类型:““字符串”}”,cs_描述:{“索引分析器”:“myFulltextAnalyzer”,“搜索分析器”:“myFulltextAnalyzer”,“类型:”:“字符串分析器”:“myFulltextAnalyzer”,“类型”:“字符串”“},”en_规范“:{”index_分析器“:”myFulltextAnalyzer“,”search_分析器“:”myFulltextAnalyzer“,”type“:”string“,”ma_规范“:{”index_分析器“:”myFulltextAnalyzer“,”search_分析器“:”myFulltextAnalyzer“,”type“:”type“,”字符串“,”cs"规范“:{”index"分析器“,”myFulltextAnalyzer“,”type“:”string“,”,“制造商”:{“索引分析器”:“myFulltextAnalyzer”,“搜索分析器”:“myFulltextAnalyzer”,“类型”:“字符串”}
2016-02-20 13:57:42+0100:<{“错误”:“RemoteTransportException[[db1][inet[/10.250.0.30:9300]][index:admin/create]];嵌套:IndexCreationException[[products]未能创建索引];嵌套:取消选中DexecutionException[java.lang.IllegalArgumentException:位置46]处的预期“];嵌套:IllegalArgumentException[预期“]'在位置46];“,”状态:500}
2016-02-20 13:57:42+0100:[500]{“错误”:“RemoteTransportException[[db1][inet[/10.250.0.30:9300]][index:admin/create]];嵌套:IndexCreationException[[products]未能创建索引];嵌套:取消选中DexecutionException[java.lang.IllegalArgumentException:位置46]处的预期“];嵌套:IllegalArgumentException[预期“]'在位置46];“,”状态:500}
Elasticsearch::Transport::Transport::Errors::InternalServerError:[500]{“error”:“RemoteTransportException[[db1][inet[/10.250.0.30:9300]][index:admin/create]];嵌套:IndexCreationException[[products]未能创建索引];嵌套:取消选中DexecutionException[java.lang.IllegalArgumentException:预期']'在位置46];嵌套:IllegalArgumentException[应为']'在位置46];“,“状态”:500}
从/opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/transport/base.rb:136:in``提高传输错误'
来自/opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/transport/base.rb:228:in“执行请求”
来自/opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/transport/http/faraday.rb:20:in“执行请求”
来自/opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-transport-1.0.13/lib/elasticsearch/transport/client.rb:119:in“执行请求”
来自/opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-api-1.0.13/lib/elasticsearch/api/namespace/common.rb:21:“执行请求”中
来自/opt/deploy/shared/bundle/ruby/2.2.0/gems/elasticsearch-api-1.0.13/lib/elasticsearch/api/actions/index/create.rb:77:in“create”
来自/opt/deploy/shared/bundle/ruby/2.2.0/bundler/gems/elasticsearch-rails-ded203569208/elasticsearch-model/lib/elasticsearch/model/index.rb:228:in'create_index!'
来自(irb):1
from/opt/depl