2017-09-27 190 views
-1

在linux上运行elasticsearch查询有什么正确的方法?我想出了下面的代码,但是由于我看到很多错误,它似乎并不正确。在linux上运行elasticsearch查询

curl -X GET http://localhost:9200/INDEXED_REPOSITORY/_search?q="constant_score" : {"filter" : { "terms" : { "description" : ["heart", "cancer", and more than 10000 keywords ]}}}} 
+0

添加围绕整个URL单引号。 –

回答

1

你错过了一些东西,像这样做:

curl -X GET http://localhost:9200/INDEXED_REPOSITORY/_search -d '{ 
    "query": { 
    "constant_score": { 
     "filter" : { 
     "terms" : { 
      "description" : ["heart", "cancer", and more than 10000 keywords ] 
     } 
     } 
    } 
    } 
}' 

or on a single line: 

curl -X GET http://localhost:9200/INDEXED_REPOSITORY/_search -d '{"query": {"constant_score": {"filter" : {"terms" : {"description" : ["heart", "cancer", and more than 10000 keywords ]}}}}}' 
+0

谢谢@Val,但我仍然收到以下错误:-bash:query :: command not found [x @ sbbioddlp002〜] $“constant_score”:{ -bash:constant_score :: command not found [x @ sbbioddlp002 〜] $“filter”:{ -bash:filter:command not found [x @ sbbioddlp002〜] $“terms”:{ -bash:terms:command not found [x @ sbbioddlp002〜] $“description” :[“心脏”,“癌症”] -bash:说明:命令未找到 [x @ sbbioddlp002〜] $} -bash:语法错误附近出现意外的令牌'}' – NinaDev

+0

它看起来像你有坏的新行您的查询,查看我的更新并尝试一行命令。 – Val