Description of common methods of SearchRequestBuilder

Description of common methods of SearchRequestBuilder

( 1 ) set Indices(String... indices): As described above, the parameter can be one or more strings, indicating the index to be retrieved;

( 2 ) set Types(String... types): The parameter can be It is one or more strings, indicating the type to be retrieved . When the parameter is 0 or this method is not called, it indicates that all types are queried ;

set SearchType(SearchType searchType): The category to be retrieved, the value is org.elasticsearch Elements of .action.search.SearchType, SearchType is an enumeration class with
   the following values:
   QUERY_THEN_FETCH: The query is executed for all blocks, but returns enough information instead of the document content (Document) . The results are sorted and ranked, based on which only the relevant chunk's document object is returned. Since only these are fetched, the size of the returned hit is exactly equal to the specified size. This is convenient for indexes with many chunks (results won't be duplicated because chunks are grouped)
   QUERY_AND_FETCH: The original (and probably fastest) implementation is simply to run on all relevant shards Perform a search and return the results. Each shard returns results of a certain size. Since each shard has returned a hit of a certain size, this type actually returns the result of a certain size for multiple shards to the caller.
   DFS_QUERY_THEN_FETCH: Same as QUERY_THEN_FETCH, expects an initial scattering to accompany the assigned term frequency for a more accurate score calculation.
   DFS_QUERY_AND_FETCH: Same as QUERY_AND_FETCH, expects an initial scatter to accompany the assigned term frequency for a more accurate score calculation.
   SCAN: Executes a browse when a search is performed without any sorting. This will automatically start scrolling the result set.
   COUNT: only counts the number of results, also performs facet.

( 4 ) set SearchType(String searchType), similar to set SearchType(SearchType searchType), the difference is that its value is a string-type SearchType, and the value can be dfs_query_then_fetch, dfsQueryThenFetch , dfs_query_and_fetch, dfsQueryAndFetch, query_then_fetch , queryThenFetch, query_and_fetch or queryAndFetch;

( 5 ) set Scroll(Scroll scroll), set Scroll(TimeValue keepAlive) and setScroll(String keepAlive), set scrolling, when the parameter is Scroll, directly use new Scroll(TimeValue) to construct a Scroll, when it is TimeValue or String, you need to convert TimeValue and String to Scroll;

( 6 ) set Timeout(TimeValue timeout) and set Timeout(String timeout), set the search timeout;

( 7 ) set Query, set the query used by the query;

( 8 ) set Filter, set the filter;

( 9 ) set M in Score, set the minimum number of Scores;

( 10 ) set From, which Score to start from;

( 11 ) set Size, how many results need to be queried;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326353216&siteId=291194637