作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
版本:
CentOS - 6.4 (Final)
Haystack - 2.1.0
ElasticSearch - 1.2.1
Java - 1.7.0_55
Django-cms - 2.3.1
pyelasticsearch - 0.6
Parse Failure [No parser for element [𠁥y]]
,但我有一个空索引。我试图确切地知道错误来自哪里,所以我尝试了:
python manage.py shell
打开 Django shell 时和做
from haystack.query import SearchQuerySet
SearchQuerySet()
SearchQuerySet().all()
SearchQuerySet().filter(content='any_text')
import datetime
from haystack import indexes
from django.contrib.auth.models import User
from cms.models import CMSPlugin, Page
class CMSPluginIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
plugin_type = indexes.CharField(model_attr='plugin_type')
language = indexes.CharField(model_attr='language')
def get_model(self):
return CMSPlugin
def index_queryset(self, using=None):
"""Used when the entire index for model is updated."""
return self.get_model().objects.all()
{{object.language}} # I added just this field to make sure is not the content of this
def search_query(request):
sqs = SearchQuerySet().all()
return HttpResponse(sqs)
Invalid JSON returned from ES: <Response [404]>
Exception Value: Invalid JSON returned from ES: <Response [404]>
[DEBUG][action.search.type] [Futurist] [haystack][2], node[inisR695RtGZ_WnEnkRr1w], [P], s[STARTED]: Failed to execute [org.elasticsearch.action.search.SearchRequest@28cfe3d9] lastShard [true]
org.elasticsearch.search.SearchParseException: [haystack][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"\ud900\udc71\ud840\udc65y\u0000\ud840\udc61":
{"\uda00\udc66\ud8c0\udc6c\ud840\udc65\ud8c0\udc65\ud8c0\udc00a\uda00\udc42\udac0\udc65":
{"\uda00\udc66\ud8c0\udc6c\ud840\udc65\u0000\ud880\udc25\udbc0\udc20":
{"\ud800\udc66\ud900\udc75\uda00\udc72\u0000\ud880\udc25\ud8c0\udc20":
{"\ud900\udc71\ud840\udc65y\u0000\ud840\udc61":
{"\ud900\udc71\ud840\udc65\udb80\udc79\ud8c0\udc73\uda00\udc72\ud980\udc6e\u0000\u0000\uda00
\udc64\ud8c0\udc73\udb40\udc61\ud900\udc63": {"\ud900\udc71\ud840\udc65y\u0000\ud840\udc61":
"\uda40\udc64\udb40\udc61\udb80\udc67\ud880\udc5f\uda40\udc74\ud880\udc28\ud880\udc6d\ud880\
udc2e\ud880\udc6d\udac0\udc70\ud980\udc75\udb40\udc69\udb80\udc20\udbc0\udc52\ud840\udc70\ud
b40\udc6f\uda80\udc6f\udac0\udc61\ud880\udc5f\ud800\udc68\ud900\udc72\udb40\udc64\udb80\udc6
3\udb40\udc75\ud840\udc74\uda00\udc79\ud880\udc00\u0000\u0002\u0000\uda34\ude80\u7f8eD\u0000
\udbbf\udfff\udbbf\udfff\u0000\ud917\udc22\udbcc\udc38\ud899\udc75\ud917\udc36\udbcc\udc39\u
d899\udc75\ud917\udc35\udbcc\udc61\ud899\udc75\ud917\udc32\udbcc\udc30\ud9d9\udc75\ud917\udc
30\ud90c\ude63\ud9d9\udc75"}},
"\ud880\udc5f\ud880\udc61\ud900\udc68\u0000\udb80\udc70\udb40\udc69": true}},
"\ud900\udc71\ud840\udc65y\u0000\ud840\udc61":
{"\ud900\udc71\ud840\udc65\udb80\udc79\ud8c0\udc73\uda00\udc72\ud980\udc6e\u0000\u0000\uda00
\udc64\ud8c0\udc73\udb40\udc61\ud900\udc63": {"\ud900\udc71\ud840\udc65y\u0000\ud840\udc61":
"\ud900\udc28)\ud89d\udc30",
"\ud900\udc64\ud800\udc66\udac0\udc75\udb80\udc74\udbc0\udc6f\ud840\udc65\ud8c0\udc61\ud840\
udc6f\u0000\ud99b\udf6c\udb40\udc61\udac0\udc61\uda40\udc79\udb80\udc65\uda00\udc77\ud8c0\ud
c6c": "\udb40\udc41D\ud8c0\udc67",
"\ud900\udc64\ud800\udc66\udac0\udc75\udb80\udc74\uda00\udc66\udac0\udc65d\u0000\u0001\u0000
\uda18\ude40\u7f8e\u0001": "\ud900\udc74\ud8c0\udc78\udbc0\udc00\udb00\udc65",
"\ud900\udc61\udb80\udc74\ud980\udc5f\udb40\udc65\ud840\udc65\ud8c0\udc61\udb80\udc65\ud9c0\
udc70\ud800\udc72\ud900\udc73\ud800\udc5f\ud900\udc75\uda00\udc72\ud880\udc65\ud8c0\udc00\u7
36c\u0000\u0000\udba4\udc30\u7f8e\udbbf\udffe\udbbf\udfff\u0001\u0000\u0001\u0000\uda38\ude8
0\u7f8e": true,
"\udb40\udc61\udac0\udc61\uda40\udc79\udb80\udc65\uda00\udc77\ud8c0\udc6c\ud800\udc63\ud8c0\
udc72\ud880\udc00\u7f8e\b\u0000\uda34\ude80\u7f8e\u0003\u0000": true}}}},
"\ud840\udc66\udb00\udc6f\ud840\udc00\u7f8e": 0, "\uda00\udc73\ud900\udc7a\u0000\u0000":
20}]]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:634)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:507)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:480)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:252)
at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:202)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:216)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:203)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:186)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.elasticsearch.search.SearchParseException: [haystack][3]: from[-1],size[-1]: Parse Failure [No parser for element [𠁥y]]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:620)
... 11 more
pyelasticsearch
.有人有类似的问题吗?
CMSPlugin
来自 django-cms 的模型,并且插件的正文/文本似乎包含一些特殊字符,并且 Java 或 Elasticsearch 无法尝试解析。这是导致 ElasticSearch/Java 崩溃的第一个字符串
\ud900\udc71\ud840\udc65y\u0000\ud900\udc74
.
c=u'\ud900\udc71\ud840\udc65y\u0000\ud900\udc74'
print c
𠁥y
SearchQuerySet()
并制作类似
SearchQuerySet().filter(content='whatever')
的内容使用 shell 或在 View 中,ElasticSearch 因上述错误而崩溃,但在执行
CURL
时运行良好
最佳答案
我相信这里的问题可能与使用 pyelasticsearch 有关。使用较新的 django-haystack(我相信 >1.0),您需要改用 elasticsearch-py。如果你尝试 pip install elasticsearch
它应该安装最新的库(1.1.1)并解决您的问题。作为额外的“以防万一”措施,您可以尝试使用 pip uninstall pyelasticsearch
删除 pyelasticsearch .这种依赖关系显示在一个非常不明显的注释中,这里:http://django-haystack.readthedocs.org/en/latest/installing_search_engines.html#elasticsearch
关于python - CentOS 6.4 + Haystack (2.1.0) + ElasticSearch (1.2.1) = SearchParseException ...解析失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24428698/
我是ElasticSeach的新手,已经为elasticseach集群中的城市列表编制了索引。每个城市包含的详细信息,例如城市,州,位置(经纬度)等。 现在,我的要求是搜索特定位置20公里范围内的城市
版本: CentOS - 6.4 (Final) Haystack - 2.1.0 ElasticSearch - 1.2.1 Java -
我是一名优秀的程序员,十分优秀!