manticoresearch v1.0.0 Manticoresearch.Api.Search
API calls for all endpoints tagged Search
.
Link to this section Summary
Functions
Perform reverse search on a percolate index
Performs a percolate search. This method must be used only on percolate indexes. Expects two paramenters: the index name and an object with array of documents to be tested. An example of the documents object: {"query":{"percolate":{"document":{"content":"sample content"}}}}
Responds with an object with matched stored queries: {'timed_out':false,'hits':{'total':2,'max_score':1,'hits':[{'_index':'idx_pq_1','_type':'doc','_id':'2','_score':'1','_source':{'query':{'match':{'title':'some'},}}},{'_index':'idx_pq_1','_type':'doc','_id':'5','_score':'1','_source':{'query':{'ql':'some | none'}}}]}}
Performs a search
Expects an object with mandatory properties: the index name the match query object Example : {'index':'movies','query':{'bool':{'must':[{'query_string':' movie'}]}},'script_fields':{'myexpr':{'script':{'inline':'IF(rating>8,1,0)'}}},'sort':[{'myexpr':'desc'},{'_score':'desc'}],'profile':true}
It responds with an object with: - time of execution - if the query timed out - an array with hits (matched documents) - additional, if profiling is enabled, an array with profiling information is attached {'took':10,'timed_out':false,'hits':{'total':2,'hits':[{'_id':'1','_score':1,'_source':{'gid':11}},{'_id':'2','_score':1,'_source':{'gid':12}}]}}
For more information about the match query syntax, additional paramaters that can be set to the input and response, please check: https://docs.manticoresearch.com/latest/html/http_reference/json_search.html.
Link to this section Functions
percolate(connection, index, percolate_request, opts \\ [])
Specs
percolate( Tesla.Env.client(), String.t(), Manticoresearch.Model.PercolateRequest.t(), keyword() ) :: {:ok, Manticoresearch.Model.SearchResponse.t()} | {:error, Tesla.Env.t()}
Perform reverse search on a percolate index
Performs a percolate search. This method must be used only on percolate indexes. Expects two paramenters: the index name and an object with array of documents to be tested. An example of the documents object: {"query":{"percolate":{"document":{"content":"sample content"}}}}
Responds with an object with matched stored queries: {'timed_out':false,'hits':{'total':2,'max_score':1,'hits':[{'_index':'idx_pq_1','_type':'doc','_id':'2','_score':'1','_source':{'query':{'match':{'title':'some'},}}},{'_index':'idx_pq_1','_type':'doc','_id':'5','_score':'1','_source':{'query':{'ql':'some | none'}}}]}}
Parameters
- connection (Manticoresearch.Connection): Connection to server
- index (String.t): Name of the percolate index
- percolate_request (PercolateRequest):
- opts (KeywordList): [optional] Optional parameters
Returns
} on success {:error, info} on failure
search(connection, search_request, opts \\ [])
Specs
search(Tesla.Env.client(), Manticoresearch.Model.SearchRequest.t(), keyword()) :: {:ok, Manticoresearch.Model.SearchResponse.t()} | {:error, Tesla.Env.t()}
Performs a search
Expects an object with mandatory properties: the index name the match query object Example : {'index':'movies','query':{'bool':{'must':[{'query_string':' movie'}]}},'script_fields':{'myexpr':{'script':{'inline':'IF(rating>8,1,0)'}}},'sort':[{'myexpr':'desc'},{'_score':'desc'}],'profile':true}
It responds with an object with: - time of execution - if the query timed out - an array with hits (matched documents) - additional, if profiling is enabled, an array with profiling information is attached {'took':10,'timed_out':false,'hits':{'total':2,'hits':[{'_id':'1','_score':1,'_source':{'gid':11}},{'_id':'2','_score':1,'_source':{'gid':12}}]}}
For more information about the match query syntax, additional paramaters that can be set to the input and response, please check: https://docs.manticoresearch.com/latest/html/http_reference/json_search.html.
Parameters
- connection (Manticoresearch.Connection): Connection to server
- search_request (SearchRequest):
- opts (KeywordList): [optional] Optional parameters
Returns
} on success {:error, info} on failure