open
pub fn open(endpoint string) Client用途
打开。
参数
endpointstring- endpoint(string)
返回
Client — 该类型的值
API
#github.com/xulang-org/packages/elasticsearch扩展包 `elasticsearch #github.com/xulang-org/packages/elasticsearch`,由模块 github.com/xulang-org/packages 提供。
github.com/xulang-org/packages · 0.1.1 · 安装与使用
openpub fn open(endpoint string) Client打开。
endpoint stringClient — 该类型的值
open_poolpub fn open_pool(endpoint string, max_idle int) Pool打开pool。
endpoint stringmax_idle intPool — 该类型的值
struct Responsepub struct Response {
pub status_code int
pub body string
}公开结构体 `Response`。
status_code intbody stringstruct Clientpub struct Client {
pub host string
pub port int
}公开结构体 `Client`。
host stringport intnew_clientpub fn new_client(endpoint string) Client构造 client。
endpoint stringClient — 该类型的值
(&mut Client) requestpub fn (c &mut Client) request(method string, path string, body string) Response`&mut Client` 上的方法:请求。失败时 throw。
c &mut Clientmethod stringpath stringbody stringResponse — 该类型的值
(&mut Client) pingpub fn (c &mut Client) ping() bool在 `&mut Client` 上调用 `ping`。
c &mut Clientbool — 是否成立
(&mut Client) infopub fn (c &mut Client) info() string在 `&mut Client` 上调用 `info`。失败时 throw。
c &mut Clientstring — 结果字符串
(&mut Client) index_docpub fn (c &mut Client) index_doc(index string, id string, doc_json string) string`&mut Client` 上的方法:下标doc。失败时 throw。
c &mut Clientindex stringid stringdoc_json stringstring — 结果字符串
(&mut Client) get_docpub fn (c &mut Client) get_doc(index string, id string) string`&mut Client` 上的方法:读取 doc。失败时 throw。
c &mut Clientindex stringid stringstring — 结果字符串
(&mut Client) delete_docpub fn (c &mut Client) delete_doc(index string, id string) bool`&mut Client` 上的方法:删除doc。失败时 throw。
c &mut Clientindex stringid stringbool — 是否成立
(&mut Client) update_docpub fn (c &mut Client) update_doc(index string, id string, doc_json string) bool`&mut Client` 上的方法:更新doc。失败时 throw。
c &mut Clientindex stringid stringdoc_json stringbool — 是否成立
(&mut Client) create_indexpub fn (c &mut Client) create_index(index string, mapping_json string) bool`&mut Client` 上的方法:创建下标。失败时 throw。
c &mut Clientindex stringmapping_json stringbool — 是否成立
(&mut Client) delete_indexpub fn (c &mut Client) delete_index(index string) bool`&mut Client` 上的方法:删除下标。失败时 throw。
c &mut Clientindex stringbool — 是否成立
(&mut Client) index_existspub fn (c &mut Client) index_exists(index string) bool`&mut Client` 上的方法:下标exists。
c &mut Clientindex stringbool — 是否成立
(&mut Client) refreshpub fn (c &mut Client) refresh(index string) bool在 `&mut Client` 上调用 `refresh`。失败时 throw。
c &mut Clientindex stringbool — 是否成立
struct Poolpub struct Pool {
pub host string
pub port int
pub endpoint string
pub state chan pool.State
pub max_idle int
}公开结构体 `Pool`。
host stringport intendpoint stringstate chan pool.Statemax_idle intnew_poolpub fn new_pool(endpoint string, max_idle int) Pool构造 pool。
endpoint stringmax_idle intPool — 该类型的值
(&Pool) getpub fn (p &Pool) get() Client在 `&Pool` 上调用 `get`。
p &PoolClient — 该类型的值
(&Pool) duppub fn (p &Pool) dup() Pool在 `&Pool` 上调用 `dup`。
p &PoolPool — 该类型的值
(&Pool) get_connpub fn (p &Pool) get_conn() int`&Pool` 上的方法:读取 conn。
p &Poolint — 该类型的值
(&Pool) put_connpub fn (p &Pool) put_conn(fd int)`&Pool` 上的方法:put连接。
p &Poolfd int(&Pool) discard_connpub fn (p &Pool) discard_conn(fd int)`&Pool` 上的方法:丢弃连接。
p &Poolfd int(&Pool) searchpub fn (p &Pool) search(index string, query_dsl string) SearchResult`&Pool` 上的方法:二分查找。失败时 throw。
p &Poolindex stringquery_dsl stringSearchResult — 该类型的值
(&Pool) search_matchpub fn (p &Pool) search_match(index string, field string, query_text string) SearchResult`&Pool` 上的方法:二分查找match。失败时 throw。
p &Poolindex stringfield stringquery_text stringSearchResult — 该类型的值
(&Pool) get_docpub fn (p &Pool) get_doc(index string, id string) string`&Pool` 上的方法:读取 doc。失败时 throw。
p &Poolindex stringid stringstring — 结果字符串
(&Pool) index_docpub fn (p &Pool) index_doc(index string, id string, doc_json string) string`&Pool` 上的方法:下标doc。失败时 throw。
p &Poolindex stringid stringdoc_json stringstring — 结果字符串
(&Pool) delete_docpub fn (p &Pool) delete_doc(index string, id string) bool`&Pool` 上的方法:删除doc。失败时 throw。
p &Poolindex stringid stringbool — 是否成立
(&Pool) pingpub fn (p &Pool) ping() bool在 `&Pool` 上调用 `ping`。
p &Poolbool — 是否成立
(&Pool) closepub fn (p &Pool) close()`&Pool` 上的方法:关闭资源。
p &Poolstruct SearchHitpub struct SearchHit {
pub id string
pub score string
pub source string
}公开结构体 `SearchHit`。
id stringscore stringsource stringstruct SearchResultpub struct SearchResult {
pub total int
pub raw_json string
pub hits []SearchHit
}公开结构体 `SearchResult`。
total intraw_json stringhits []SearchHit(&mut Client) searchpub fn (c &mut Client) search(index string, query_dsl string) SearchResult`&mut Client` 上的方法:二分查找。失败时 throw。
c &mut Clientindex stringquery_dsl stringSearchResult — 该类型的值
(&mut Client) search_matchpub fn (c &mut Client) search_match(index string, field string, query_text string) SearchResult`&mut Client` 上的方法:二分查找match。失败时 throw。
c &mut Clientindex stringfield stringquery_text stringSearchResult — 该类型的值