2017-09-27 26 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