33
44An `alias` mapping defines an alternate name for a field in the index.
55The alias can be used in place of the target field in <<search, search>> requests,
6- and select other APIs like <<search-field-caps, field capabilities>>.
6+ and selected other APIs like <<search-field-caps, field capabilities>>.
77
88[source,js]
99--------------------------------
@@ -43,25 +43,20 @@ GET _search
4343<1> The path to the target field. Note that this must be the full path, including any parent
4444objects (e.g. `object1.object2.field`).
4545
46- All relevant components of the search request accept field aliases. In particular, aliases can be
46+ Almost all components of the search request accept field aliases. In particular, aliases can be
4747used in queries, aggregations, and sort fields, as well as when requesting `docvalue_fields`,
4848`stored_fields`, suggestions, and highlights. Scripts also support aliases when accessing
49- field values.
49+ field values. Please see the section on <<unsupported-apis, unsupported APIs>> for exceptions.
5050
5151In some parts of the search request and when requesting field capabilities, field wildcard patterns can be
5252provided. In these cases, the wildcard pattern will match field aliases in addition to concrete fields:
5353
5454[source,js]
5555--------------------------------
56- GET /_search
57- {
58- "query" : {
59- "match_all": {}
60- },
61- "docvalue_fields": ["route_*", "transit_mode"]
62- }
56+ GET trips/_field_caps?fields=route_*,transit_mode
6357--------------------------------
6458// CONSOLE
59+ // TEST[continued]
6560
6661[[alias-targets]]
6762==== Alias targets
@@ -88,13 +83,14 @@ source filtering. For example, the following request will return an empty result
8883--------------------------------
8984GET /_search
9085{
91- "query" : {
92- "match_all": {}
93- },
94- "_source": "route_length_miles"
86+ "query" : {
87+ "match_all": {}
88+ },
89+ "_source": "route_length_miles"
9590}
9691--------------------------------
9792// CONSOLE
93+ // TEST[continued]
9894
9995Finally, currently only the search and field capabilities APIs will accept and resolve
10096field aliases. Other APIs that accept field names, such as <<docs-termvectors, term vectors>>,
0 commit comments