- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用ElasticSearch 1.7.3为我公司的搜索引擎实现“按您说的意思”功能。我已经按照文档设置了词组建议程序,并创建了一个自定义映射来支持它。
但是,当我执行_suggest
查询时,我得到ElasticsearchIllegalArgumentException[Suggester[simple_phrase] not supported]
。我究竟做错了什么?
这是我的查询:
POST knowledge_graph/entities/_suggest
{
"suggest": {
"text" : "apple in",
"simple_phrase": {
"phrase" : {
"field" : "canonical_name"
}
}
}
}
{
"_shards": {
"total": 5,
"successful": 0,
"failed": 5,
"failures": [
{
"index": "knowledge_graph",
"shard": 0,
"status": 500,
"reason": "BroadcastShardOperationFailedException[[knowledge_graph][0] ]; nested: ElasticsearchException[failed to execute suggest]; nested: ElasticsearchIllegalArgumentException[Suggester[simple_phrase] not supported]; "
},
...
]
}
}
{
"knowledge_graph": {
"aliases": {},
"mappings": {
"entities": {
"properties": {
"autocomplete": {
"type": "completion",
"analyzer": "simple",
"payloads": true,
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
},
"canonical_name": {
"type": "string",
"analyzer": "simple",
"fields": {
"shingles": {
"type": "string",
"analyzer": "simple_shingle_analyzer"
}
}
},
"entity_query": {
"properties": {
"simple_phrase": {
"properties": {
"phrase": {
"properties": {
"field": {
"type": "string"
}
}
}
}
},
"text": {
"type": "string"
}
}
},
"suggest": {
"properties": {
"simple_phrase": {
"properties": {
"phrase": {
"properties": {
"field": {
"type": "string"
}
}
}
}
},
"text": {
"type": "string"
}
}
}
}
}
},
"settings": {
"index": {
"creation_date": "1449251691345",
"analysis": {
"filter": {
"shingles_1_6": {
"type": "shingle",
"max_shingle_size": "6",
"output_unigrams_if_no_shingles": "true"
}
},
"analyzer": {
"simple_shingle_analyzer": {
"type": "custom",
"filter": [
"lowercase",
"shingles_1_6"
],
"tokenizer": "standard"
}
}
},
"number_of_shards": "5",
"number_of_replicas": "0",
"version": {
"created": "1070399"
},
"uuid": "g_Yp7z6kQHCDRtd6TvVlzQ"
}
},
"warmers": {}
}
}
最佳答案
有两种执行suggest
请求的方法,一种使用_search
端点,另一种使用_suggest
端点。
从Docs
Suggest requests executed against the _suggest endpoint should omit the surrounding suggest element which is only used if the suggest request is part of a search.
_search
API执行查询,则查询将起作用
POST knowledge_graph/entities/_search <---- here
{
"suggest": {
"text" : "apple in",
"simple_phrase": {
"phrase" : {
"field" : "canonical_name"
}
}
},
"size" : 0
}
_suggest
端点进行查询,请尝试此操作
POST knowledge_graph/_suggest
{
"suggest": {
"text": "apple in",
"phrase": {
"field": "canonical_name"
}
}
}
关于elasticsearch - 使用词组建议程序时遇到ElasticsearchIllegalArgumentException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34097933/
我的代码是 curl -XGET 'http://localhost:9200/web/_suggest?pretty' -d ' { "brand-suggest": {"completion":
我有一个 Elasticsearch 节点设置。当我通过curl命令查询索引时,我得到了预期的输出。 curl -XPOST 'http://localhost:9200/one/employee/_
我正在尝试使用https://github.com/sscarduzio/elasticsearch-readonlyrest-plugin 我的E.S版本是1.4.4,当我运行第一个命令时: bin
我正在使用Elastic Search为名为people的索引实现一个自动建议字段: 字段person_name_suggest的映射如下所示- person_name_suggest: { ty
我有以下文件{ "_index" : "Testdb", "_type" : "directUser", "_id" : "123", "_version" : 8, "found"
我是一名优秀的程序员,十分优秀!