调试弹性搜索 [英] debugging elasticsearch

查看:91
本文介绍了调试弹性搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用轮胎和弹性材料。该服务已经开始使用端口9200.但是,它返回2个错误:

 org.elasticsearch.search.SearchParseException:国家] [0]:从[-1],大小[-1]:解析失败[无法解析源[{查询:{query_string:{查询:名称:}}}] 

 code>导致:org.apache.lucene.queryParser.ParseException:无法解析'name:':在第1行第5列遇到&EOF>。 

所以,我重新安装了弹性搜索和服务容器。服务开始正常。



现在,当我使用轮胎搜索时,结果应该出现而没有结果我没有收到任何错误消息。



有人有什么想法可以找出什么是错误的,更不用说解决它了吗?

解决方案

首先,在通常的情况下,您不需要重新索引任何。这取决于您如何安装和配置弹性搜索,但是安装和升级时。使用 Homebrew ,数据将保持安全。



其次,不需要重新安装任何内容。你所看到的错误意味着它在锡上说: SearchParseException ,即。您的查询无效:

  {query:{query_string:{query:name:}} } 

请注意,您没有传递名称限定符的任何查询字符串。你必须传递一些东西,例如:

  {query:{query_string:{query:name: foo}}} 

或以Ruby语言:

  Tire.index('test'){query {stringname:hey}} 

请参阅轮胎上的Railscasts剧集的更新一个例子如何捕获错误,因为不正确的Lucene查询。


I'm using tire and elasticsearch. The service has started using port 9200. However, it was returning 2 errors:

"org.elasticsearch.search.SearchParseException: [countries][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"query_string":{"query":"name:"}}}]]"

and

"Caused by: org.apache.lucene.queryParser.ParseException: Cannot parse 'name:': Encountered "<EOF>" at line 1, column 5."

So, I reinstalled elasticsearch and the service container. Service starts fine.

Now, when I search using tire I get no results when results should appear and I don't receive any error messages.

Does anybody have any idea how I might find out what is wrong, let alone fix it?

解决方案

first of all, you don't need to reindex anything, in the usual cases. It depends how you installed and configured elasticsearch, but when you install and upgrade eg. with Homebrew, the data are persisted safely.

Second, no need to reinstall anything. The error you're seeing means just what it says on the tin: SearchParseException, ie. your query is invalid:

{"query":{"query_string":{"query":"name:"}}}

Notice that you didn't pass any query string for the name qualifier. You have to pass something, eg:

{"query":{"query_string":{"query":"name:foo"}}}

or, in Ruby terms:

Tire.index('test') { query { string "name:hey" } }

See this update to the Railscasts episode on Tire for an example how to catch errors due to incorrect Lucene queries.

这篇关于调试弹性搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆