(Elasticsearch + IK分析器)为什么我在使用_analyze API时得到null_pointer_exception?

时间:2017-09-05 07:40:14

标签: elasticsearch

网址是

http://188.188.40.42:9200/appindex/_analyze?analyzer=ik_synonyms&text=ahaha

我收到了这个错误

"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[40-42][188.188.40.42:9300][indices:admin/analyze[s]]"
}
],
"type": "null_pointer_exception",
"reason": null
},
"status": 500
}

这是我的设置

"settings": {
"index": {
"creation_date": "1496822869317",
"analysis": {
"filter": {
"my_synonym_filter": {
"type": "synonym",
"synonyms_path": "synonym.txt"
}
},
"analyzer": {
"ik_synonyms": {
"filter": [
"my_synonym_filter"
],
"tokenizer": "ik_smart"
}
}
}

我定义了ik_synonyms,为什么我在使用它时得到了null_pointer_exception?

es的版本是2.1.1

我发现我的ES从不打印日志,这是我的logging.yml

es.logger.level: DEBUG
rootLogger: ${es.logger.level}, console, file
logger:
  # log action execution errors for easier debugging
  action: WARN

  # deprecation logging, turn to DEBUG to see them
  deprecation: INFO, deprecation_log_file

  # reduce the logging for aws, too much is logged under the default INFO
  com.amazonaws: WARN
  # aws will try to do some sketchy JMX stuff, but its not needed.
  com.amazonaws.jmx.SdkMBeanRegistrySupport: ERROR
  com.amazonaws.metrics.AwsSdkMetrics: ERROR

  org.apache.http: ERROR

  # gateway
  #gateway: DEBUG
  #index.gateway: DEBUG

  # peer shard recovery
  #indices.recovery: DEBUG

  # discovery
  #discovery: TRACE

  index.search.slowlog: TRACE, index_search_slow_log_file
  index.indexing.slowlog: TRACE, index_indexing_slow_log_file

additivity:
  index.search.slowlog: false
  index.indexing.slowlog: false
  deprecation: false

 ...

1 个答案:

答案 0 :(得分:0)

您是否将synonym.txt放在正确的文件夹中?看起来ES找不到您的配置文件。

  

以上配置同义词过滤器,路径为   analysis / synonym.txt(相对于配置位置)。

来源和更多详情:https://www.elastic.co/guide/en/elasticsearch/reference/2.1/analysis-synonym-tokenfilter.html