Re: [PATCH v2 compass-ci] data-api: add es search api

8 Feb
2022
8 Feb
'22
11:46 a.m.
On Tue, Feb 08, 2022 at 10:28:21AM +0800, Wu Fengguang wrote:
+ def self.search(index, params) + request_body = JSON.parse(params) + query = request_body['query'] || {'query' => {}} + + return "index is empty!" if index.nil? + return "#{index} is not opened" unless OPEN_INDEX.include?(index)
这里的return会在上一级被作为HTTP 200 但看起来是一个错误情况。
是的,抛出错误更好一些。 Thanks, Jihui
+ def self.search_by_sql(index, params) + request_body = JSON.parse(params) + query = request_body['query'] + + return "query table is empty!" if index.nil? + return "#{index} is not opened" unless OPEN_INDEX.include?(index)
同上。
Thanks, Fengguang
1113
Age (days ago)
1113
Last active (days ago)
0 comments
1 participants
participants (1)
-
Wei Jihui