Skip to content

Commit

Permalink
Document that arrays are returned in an undefined order.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani committed Jul 27, 2020
1 parent 594d631 commit 840cd11
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions docs/reference/search/search-fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ the `_source`. Other mapping options are also respected, including
<<ignore-above, `ignore_above`>>, <<ignore-malformed, `ignore_malformed`>> and
<<null-value, `null_value`>>.

NOTE: The `fields` response always returns an array of values for each field,
even when there is a single value in the `_source`. This is because {es} has
no dedicated array type, and any field could contain multiple values. The
`fields` parameter also does not guarantee that array values are returned in
a specific order. See the mapping documentation on <<array, arrays>> for more
background.



[discrete]
[[docvalue-fields]]
=== Doc value fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,11 @@ public void parse(ParseContext context) throws IOException {
* In addition to pulling out the values, mappers can parse them into a standard form. This
* method delegates parsing to {@link #parseSourceValue} for parsing. Most mappers will choose
* to override {@link #parseSourceValue} -- for example numeric field mappers make sure to
* parse the source value into a number of the right type.
* parse the source value into a number of the right type. Some mappers may need more
* flexibility and can override this entire method instead.
*
* Some mappers may need more flexibility and can override this entire method instead.
* Note that for array values, the order in which values are returned is undefined and should
* not be relied on.
*
* @param lookup a lookup structure over the document's source.
* @param format an optional format string used when formatting values, for example a date format.
Expand Down

0 comments on commit 840cd11

Please sign in to comment.