- 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/
我想用 Java 编写一个正则表达式来匹配一个单词字符和空格序列,然后是一个单词字符和空格序列的“子类”字符序列: 应该匹配的示例字符串: a subclass of b a and b subcla
考虑到我们有以下输入数据表。 import pandas as pd #Pandas settings to see all the data when printing pd.set_option(
我们如何在同义词集中找到单词短语?特别是,将此同义词集用于形容词“booked”: booked, engaged, set-aside -- (reserved in advance) 我用的是Ri
我是一名优秀的程序员,十分优秀!