我对弹性搜索和Linux都是全新的。因为2个星期前的一个项目,我开始学习它们。所以,对不起,如果我的问题太简单了。 我正在尝试编写一个查询,以帮助我根据存储库中的关键字列表(8000个关键字)找出返回的唯一记录的数量。这是我想出的代码。这是我想出的代码:
curl http://localhost:9200/INDEXED_REPOSITORY/_search?q="constant_score" : {"filter" : { "terms" : { "description" : ["heart", "cancer", and 7000 more keywords that I just pasted here]}}}}
但我收到以下错误:
Couldn't resolve host 'constant_score'
curl: (6) Couldn't resolve host ':'
curl: (3) [globbing] unmatched brace at pos 8
curl: (6) Couldn't resolve host ':'
curl: (3) [globbing] unmatched brace at pos 2
curl: (6) Couldn't resolve host 'terms'
curl: (6) Couldn't resolve host ':'
curl: (3) [globbing] unmatched brace at pos 2
我不明白我做错了什么。这有什么解决方案吗?
答案 0 :(得分:0)
我更喜欢使用curl的-d选项而不是查询字符串来传递查询。 这应该有效:
curl -XGET "http://localhost:9200/INDEXED_REPOSITORY/_search" -d'
{
"query": {
"constant_score": {
"filter": {
"terms": {
"description": [
"heart",
"cancer"
]
}
}
}
}
}'