...
Operation | Description |
---|
searchDocumentsByIndex | Performs a search on all documents across all types within a specified index. |
searchDocumentByTypes | Performs a search on all documents documents within a specific type in a specified index based on specified types. |
searchByQuery | Performs a search across all indices and all types. |
multiSearch | Executes multiple search requests within the same API. |
...
Code Block |
---|
language | xml |
---|
title | searchDocumentsByIndex |
---|
|
<elasticsearch.searchDocumentsByIndex>
<indexName>{$ctx:indexName}</indexName>
<query>{$ctx:query}</query>
<explain>{$ctx:explain}</explain>
<fields>{$ctx:fields}</fields>
<sort>{$ctx:sort}</sort>
<timeout>{$ctx:timeout}</timeout>
<terminateAfter>{$ctx:terminateAfter}</terminateAfter>
<from>{$ctx:from}</from>
<size>{$ctx:size}</size>
<searchType>{$ctx:searchType}</searchType>
<source>{$ctx:source}</source>
<scriptFields>{$ctx:scriptFields}</scriptFields>
<fieldDataFields>{$ctx:fieldDataFields}</fieldDataFields>
<highlight>{$ctx:highlight}</highlight>
<indicesBoost>{$ctx:indicesBoost}</indicesBoost>
<minScore>{$ctx:minScore}</minScore>
<trackScores>{$ctx:trackScores}</trackScores>
<version>{$ctx:version}</version>
<scroll>{$ctx:scroll}</scroll>
<queryCache>{$ctx:queryCache}</queryCache>
<partialFields>{$ctx:partialFields}</partialFields>
<postFilter>{$ctx:postFilter}</postFilter>
<aggregation>{$ctx:aggregation}</aggregation>
<rescore>{$ctx:rescore}</rescore>
<preference>{$ctx:preference}</preference>
<innerHits>{$ctx:innerHits}</innerHits>
<ignoreUnavailable>{$ctx:ignoreUnavailable}</ignoreUnavailable>
<allowNoIndices>{$ctx:allowNoIndices}</allowNoIndices>
<expandWildcards>{$ctx:expandWildcards}</expandWildcards>
</elasticsearch.searchDocumentsByIndex> |
Properties
indexName:
The name of the index.query:
The query string used to perform the search.explain:
If set to true
, this provide an explanation of how scoring of the hits was computed for each hit.fields:
Specify the Set this to true
if you want detailed information about score computation returned as part of a hitfields:
A comma separated list of fields to return for each hit as a comma separated list. Not specifying a value will cause no fields to return.sort:
The type of sorting to perform. Can either be in the form of fieldName
, or fieldName:asc
/fieldName:desc
. The fieldName
can either be an actual field within the document, or the special score name to indicate sorting based on scores. There can be several sort parameters (order is important). timeout:
A An operation timeout value for the search. This bounds causes the search request to be executed execute within the specified time value and returns the hits accumulated up to that point when expired. There is no value set for this by default.terminateAfter:within that period of time. terminateAfter:
The maximum number of documents to collect for each shard, which upon reaching causes the query execution to terminate early. If set, the response will have a boolean field terminated_early to indicate that the query execution has terminated early. There is no value set for this by default. from:
The starting from index of the hits to returnoffset. Default value is 0.size:
The number of hits to return. Default value is 10.searchType:
The search operation type of the search to perform. Possible values are: dfs_query_then_fetch
, dfs_query_and_fetch
, query_then_fetch
, query_and_fetch
, count
, scan
. The default value is: query_then_fetch
. For more information on the different types of search that can be performed, see Search Type.source:
If set Set this to true
, this controls how if you want the source is fields returned in the response.scriptFields:
Allows to return a script evaluation Provide a script that can work on fields that are not stored, and return custom values for each hit based on the values taken from different fieldsscript evaluation. fieldDataFields:
Allows A comma separated list of fields to return as the field data representation of a field for each hit.highlight:
Specify the fields in which search results that should be highlighted in each search hit .indicesBoost:
Allows to configure different boost levels per index when searching across more than one index. This is useful when hits coming from a particular index have a higher priority over hits coming from another index (social graph where each user has an index).minScore:
Specify a value so that documents that have with a score less than the specified value specified is are excluded from the search.trackScores:
Set this to true
if you want to track scores and return them as part of each hitcalculate and return scores even if they are not used for sorting.version:
If set Set this to true
this returns a version if you want the document version returned for each hit.scroll:
Specify the duration that you want to keep the search context open. The how long a consistent view of the index should be maintained for scrolled search. The duration should be specified in time units. For information on supported time units, see see Time units.queryCache:
Set this to to true
if you want to enable caching of search results for requests.partialFields:
Used to use Specify wildcards to control based on what part of the source will be you want loaded.postFilter:
If you need to differentially filter search resultshits, you can specify the search values here. Values other than what is specified here will be removed from the search resultshits.aggregation:
Specify the document fields from which values should be extracted for aggregation.rescuerrescore:
A second query to be executed on the results returned by the original query.preference:
Controls a preference of which shard replicas to execute the search request onSpecify the shard on which the search operation should be performed.innerHits:
Specify a definition for this property so that for each search hit the search result returns additional that returns additional nested hits that caused the a search hit to satisfy a different scope, for each search hit in the search response.ignoreUnavailable:
Used to control whether Set this to true
if you want to ignore if any specified indices are any index that is unavailable.allowNoIndices:
Used to control whether to fail if a wildcard indices expressions results into no concrete indicesSet this to true
if you want to ignore an index when a wildcard index expression results in no concrete index.expandWildcards:
Used to control to what kind of concrete indices wildcard indices expression expand toSet this to true
if you want to expand wildcard expression to concrete indices.
Sample request
...
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
Anchor |
---|
| searchDocumentByTypes |
---|
| searchDocumentByTypes |
---|
|
Searching all documents within ...
a specified index based on specified types
The searchDocumentByTypes
operation performs a search on all documents within a specific type in a specified index based on specified types.
Code Block |
---|
language | xml |
---|
title | searchDocumentByTypes |
---|
|
<elasticsearch.searchDocumentByTypes>
<indexName>{$ctx:indexName}</indexName>
<query>{$ctx:query}</query>
<explain>{$ctx:explain}</explain>
<fields>{$ctx:fields}</fields>
<sort>{$ctx:sort}</sort>
<timeout>{$ctx:timeout}</timeout>
<terminateAfter>{$ctx:terminateAfter}</terminateAfter>
<from>{$ctx:from}</from>
<size>{$ctx:size}</size>
<searchType>{$ctx:searchType}</searchType>
<source>{$ctx:source}</source>
<scriptFields>{$ctx:scriptFields}</scriptFields>
<fieldDataFields>{$ctx:fieldDataFields}</fieldDataFields>
<highlight>{$ctx:highlight}</highlight>
<indicesBoost>{$ctx:indicesBoost}</indicesBoost>
<minScore>{$ctx:minScore}</minScore>
<trackScores>{$ctx:trackScores}</trackScores>
<version>{$ctx:version}</version>
<scroll>{$ctx:scroll}</scroll>
<type>{$ctx:type}</type>
<queryCache>{$ctx:queryCache}</queryCache>
<partialFields>{$ctx:partialFields}</partialFields>
<postFilter>{$ctx:postFilter}</postFilter>
<aggregation>{$ctx:aggregation}</aggregation>
<rescore>{$ctx:rescore}</rescore>
<preference>{$ctx:preference}</preference>
<innerHits>{$ctx:innerHits}</innerHits>
<ignoreUnavailable>{$ctx:ignoreUnavailable}</ignoreUnavailable>
<allowNoIndices>{$ctx:allowNoIndices}</allowNoIndices>
<expandWildcards>{$ctx:expandWildcards}</expandWildcards>
</elasticsearch.searchDocumentByTypes> |
Properties
indexName:
The name of the index.query:
The query string used to perform the search.explain:
If set to true
, this provide an explanation of how scoring of the hits was computed for each Set this to true
if you want detailed information about score computation returned as part of a hit.fields:
Specify the A comma separated list of fields to return for each hit as a comma separated list. Not specifying a value will cause no fields to return.sort:
The type of sorting to perform. Can either be in the form of fieldName
, or fieldName:asc
/fieldName:desc
. The fieldName
can either be an actual field within the document, or the special score name to indicate sorting based on scores. There can be several sort parameters (order is important). timeout:
A An operation timeout value for the search. This bounds causes the search request to be executed execute within the specified time value and returns the hits accumulated up to that point when expired. There is no value set for this by default.within that period of time. terminateAfter:
The maximum number of documents to collect for each shard, which upon reaching causes the query execution to terminate early. If set, the response will have a boolean field terminated_early to indicate whether that the query execution has actually terminated early. There is no value set for this by default.from: from:
The starting from index of the hits to returnoffset. Default value is 0.size:
The number of hits to return. Default value is 10.searchType:
The search operation type of the search to perform. Possible values are: dfs_query_then_fetch
, dfs_query_and_fetch
, query_then_fetch
, query_and_fetch
, count
, scan
. The default value is: query_then_fetch
. For more information on the different types of search that can be performed, see Search Type.source:
If set Set this to true
, this controls how if you want the source is fields returned in the response.scriptFields:
Allows to return a script evaluation Provide a script that can work on fields that are not stored, and return custom values for each hit based on the values taken from different fieldsscript evaluation. fieldDataFields:
Allows A comma separated list of fields to return as the field data representation of a field for each hit.highlight:
Specify the fields in which search results that should be highlighted in each search hit .indicesBoost:
Allows to configure different boost levels per index when searching across more than one index. This is useful when hits coming from a particular index have a higher priority over hits coming from another index (social graph where each user has an index).minScore:
Specify a value so that documents that have with a score less than the specified value specified is are excluded from the search.trackScores:
Set this to true
to track scores and return them as part of each hit if you want to calculate and return scores even if they are not used for sorting.version:
Returns a version Set this to true
if you want the document version returned for each search hit.scroll:
While a search request returns a single page of results, the scroll API can be used to retrieve large numbers of results (or even all results) from a single search request, in much the same way as you would use a cursor on a traditional database.type:
The type inside which the search would be performed.queryCache:
To enable or disable the Specify how long a consistent view of the index should be maintained for scrolled search. The duration should be specified in time units. For information on supported time units, see Time units.type:
A comma separated list of document types to search.queryCache:
Set this to true
if you want to enable caching of search results for requests.partialFields:
Used to use Specify wildcards to control based on what part of the source will be you want loaded.postFilter:
Remove results from response that have values other than thisIf you need to differentially filter search hits, you can specify the search values here. Values other than what is specified here will be removed from the search hits.aggregation:
Aggregate data within a document set contextSpecify the document fields from which values should be extracted for aggregation.rescore:
Used to improve precision by reordering just the top (e.g. 100 - 500) documents returned by the query and postFilter phasesA second query to be executed on the results returned by the original query.preference:
Controls a preference of which shard replicas to execute the search request onSpecify the shard on which the search operation should be performed.innerHits:
Used to return per search hit in the search response additional Specify a definition that returns additional nested hits that caused a search hit to match in satisfy a different scope, for each search hit in the search response.ignoreUnavailable:
Used to control whether Set this to true
if you want to ignore if any specified indices are any index that is unavailable.allowNoIndices:
Used to control whether to fail if a wildcard indices expressions results into no concrete indicesSet this to true
if you want to ignore an index when a wildcard index expression results in no concrete index.expandWildcards:
Used to control to what kind of concrete indices wildcard indices expression expand toSet this to true
if you want to expand wildcard expression to concrete indices.
Sample request
Following is a sample REST/JSON request that can be handled by the searchDocumentByTypes
operation.
...
Code Block |
---|
language | xml |
---|
title | searchByQuery |
---|
|
<elasticsearch.searchByQuery>
<query>{$ctx:query}</query>
<explain>{$ctx:explain}</explain>
<fields>{$ctx:fields}</fields>
<sort>{$ctx:sort}</sort>
<timeout>{$ctx:timeout}</timeout>
<terminateAfter>{$ctx:terminateAfter}</terminateAfter>
<from>{$ctx:from}</from>
<size>{$ctx:size}</size>
<searchType>{$ctx:searchType}</searchType>
<source>{$ctx:source}</source>
<scriptFields>{$ctx:scriptFields}</scriptFields>
<fieldDataFields>{$ctx:fieldDataFields}</fieldDataFields>
<highlight>{$ctx:highlight}</highlight>
<indicesBoost>{$ctx:indicesBoost}</indicesBoost>
<minScore>{$ctx:minScore}</minScore>
<trackScores>{$ctx:trackScores}</trackScores>
<version>{$ctx:version}</version>
<scroll>{$ctx:scroll}</scroll>
<queryCache>{$ctx:queryCache}</queryCache>
<partialFields>{$ctx:partialFields}</partialFields>
<postFilter>{$ctx:postFilter}</postFilter>
<aggregation>{$ctx:aggregation}</aggregation>
<rescore>{$ctx:rescore}</rescore>
<preference>{$ctx:preference}</preference>
<innerHits>{$ctx:innerHits}</innerHits>
</elasticsearch.searchByQuery> |
Properties
query:
The query string used to perform the search.explain:
If set to true
, this provide an explanation of how scoring of the hits was computed for each hit.fields:
Specify the fields to return for each hit as a comma separated list. Not specifying a value will cause no fields to return.sort:
The type of sorting to perform. Can either be in the form of fieldName
, or fieldName:asc
/fieldName:desc
. The fieldName
can either be an actual field within the document, or the special score name to indicate sorting based on scores. There can be several sort parameters (order is important). timeout:
A timeout value for the search. This bounds the search request to be executed within the specified time value and returns the hits accumulated up to that point when expired. There is no value set for this by default.terminateAfter:
The maximum number of documents to collect for each shard, which upon reaching causes the query execution to terminate early. If set, the response will have a boolean field terminated_early to indicate whether the query execution has actually terminated early. There is no value set for this by default.from:
The starting from index of the hits to return. Default value is 0.size:
The number of hits to return. Default value is 10.searchType:
The type of the search to perform. Possible values are: dfs_query_then_fetch
, dfs_query_and_fetch
, query_then_fetch
, query_and_fetch
, count
, scan
. The default value is: query_then_fetch
. For more information on the different types of search that can be performed, see Search Type.source:
If set to true
, this controls how the source is returned.scriptFields:
Allows to return a script evaluation for each hit based on the values taken from different fields. fieldDataFields:
Allows to return the field data representation of a field for each hit.highlight:
Specify the fields in which search results should be highlighted.indicesBoost:
Allows to configure different boost levels per index when searching across more than one index. This is useful when hits coming from a particular index have a higher priority over hits coming from another index (social graph where each user has an index).minScore:
Specify a value so that documents that have a score less than the value specified is excluded from the search.trackScores:
Set this to true
to track scores and return them as part of each hit.version:
Returns a version for each search hit.scroll:
While a search request returns a single page of results, the scroll API can be used to retrieve large numbers of results (or even all results) from a single search request, in much the same way as you would use a cursor on a traditional database.queryCache:
To enable or disable the caching of search results for requests.partialFields:
Used to use wildcards to control what part of the source will be loaded.postFilter:
Remove results from response that have values other than this.aggregation:
Aggregate data within a document set context.rescore:
Used to improve precision by reordering just the top (e.g. 100 - 500) documents returned by the query and postFilter phases.preference:
Controls a preference of which shard replicas to execute the search request on.innerHits:
Used to return per search hit in the search response additional nested hits that caused a search hit to match in a different scope.
...