
coco/concept-search-api用于在Amazon Elasticsearch集群中搜索概念的API服务。
注意:AWS SDK for Go目前不包含对ES数据平面API的支持,但自v1.2.0版本起已暴露签名器(Signer)。
访问AES(Amazon Elasticsearch Service)的实现方式:
适用于需要从Amazon Elasticsearch集群中检索概念数据的应用场景,如内容管理系统、知识图谱查询、自动补全功能等。
确保本地已安装dep工具,如未安装,执行以下命令:
bashcurl [***] | sh
bashmkdir $GOPATH/src/github.com/Financial-Times/concept-search-api cd $GOPATH/src/github.com/concept-search-api git clone [***] cd concept-search-api && dep ensure -vendor-only go build ./concept-search-api --aws-access-key="{access key}" --aws-secret-access-key="{secret key}"
可通过命令行参数配置服务,支持以下参数(未指定时使用默认值):
aws-access-key:AWS访问密钥(必填)aws-secret-access-key:AWS密钥(必填)elasticsearch-endpoint:Elasticsearch端点elasticsearch-region:Elasticsearch区域port:服务运行端口(默认:8080)index-name:搜索索引名(默认:concept)elasticsearch-index:Elasticsearch索引(默认:concept)search-result-limit:最大返回结果数(默认:50)elasticsearch-trace:是否启用ES跟踪(默认:false)需本地运行Elasticsearch实例,并设置环境变量:
bashexport ELASTICSEARCH_TEST_URL=http://localhost:9200
执行测试命令:
bashgo test -race ./...
使用-short选项跳过集成测试:
bashgo test -race -short ./...
用于搜索概念,请求体为包含term字段的JSON,term值为搜索条件。
搜索"FOO":
bashcurl -XPOST {concept-search-api-url}/concept/search -d '{"term":"FOO"}'
include_score=true:返回结果中包含匹配分数
bashcurl -XPOST {concept-search-api-url}/concept/search?include_score=true -d '{"term":"FOO"}'
searchAllAuthorities=true:扩展搜索域至所有权威来源(TME、Smartlogic、Factset等)
bashcurl -XPOST {concept-search-api-url}/concept/search?searchAllAuthorities=true -d '{"term":"FOO"}'
include_deprecated=true:包含已弃用的概念
bashcurl -XPOST {concept-search-api-url}/concept/search?include_deprecated=true -d '{"term":"FOO"}'
json[ { "id": "[***]", "apiUrl": "[***]", "prefLabel": "FOO LLC", "types": [ "[***]", "[***]", "[***]" ], "directType": "[***]", "aliases": ["FOO LLC", "FOO"], "score": 10.***, "isDeprecated": true }, { "id": "[***]", "apiUrl": "[***]", "prefLabel": "FOO International", "types": [ "[***]", "[***]", "[***]" ], "directType": "[***]", "aliases": ["FOO International", "FOO INTERNATIONAL"], "score": 2.8585405 } ]
用于类型提前(typeahead)风格的概念查询,type参数为必填项。
bashcurl {concept-search-api-url}/concepts?type=[***]
mode=search:激活搜索模式,需配合q参数指定搜索词
bashcurl {concept-search-api-url}/concepts?type=[***]
boost=authors:在搜索模式下提升作者相关结果(仅支持作者类型)
bashcurl {concept-search-api-url}/concepts?type=[***]
searchAllAuthorities=true:扩展搜索域至所有权威来源include_deprecated=true:包含已弃用的概念返回标准FT格式的服务连通性和集群健康状态。
返回ES集群的详细健康状态,格式与{elasticsearch-endpoint}/_cluster/health一致。服务不可用时返回503。
服务健康时返回200,不健康时返回503(服务不可用)。
更多详情请参见Swagger YML。

manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务