0
_search命令現在是我面臨的另一個問題:當我在cygwin運行運行在PHP
$ curl -X GET 'http://localhost:9200/sample/new/_search?pretty=true' -d '{ fields:"price_incl_tax","product_id"],query:{range:{price_incl_tax:{gte:1000,lte:1500}}} }'
,它的工作原理,並給出正確的結果。 但是,當我在瀏覽器中打開鏈接 "http://localhost:9200/sample/new/_search?pretty=true -d ' { fields:["price_incl_tax","product_id"],query:{range:{price_incl_tax:{gte:1000,lte:1500}}} }'"
,我得到了錯誤的答案。我得到20(everything) results
,而我應該得到only 2
。該怎麼辦?提前致謝。
其實我是想用PHP命令得到的結果,我無法得到它。我使用這些函數: 'function call'($ path,$ http = array()){ if(!$ this-> index)throw new Exception('$ this-> index needs a value'); return json_decode(file_get_contents($ this-> server。'/'。$ this-> index。'/'。$ path,NULL,stream_context_create(array('http'=> $ http)))); } 'function nice_format'($ type,$ q){ \t return $ this-> call($ type。'/ _search?'。http_build_query(array('pretty'=>「true -d」。$ q))); } – Vipul
我得到了答案....代替第二個函數,我應該使用這個: function'nice_format'($ type,$ q){ return $ this-> call($ type。'/ _search ?'pretty = true',array('method'=>'GET','content'=> $ q));; } – Vipul
如果您將您的問題重新設定爲PHP問題,回答問題並接受答案,對其他用戶可能會有所幫助。回答自己的問題並接受答案有助於爲其他用戶節省時間。他們不再需要通讀整個問題才意識到它已經得到解答。 – imotov