From 414bbc5ed66b843f3b9d1420d8c0da9c17c59ba9 Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Wed, 3 Jul 2019 10:50:12 -0400 Subject: [PATCH 1/3] [DOCS] Clarify array is not a field datatype --- docs/reference/mapping/types.asciidoc | 10 ++++++---- docs/reference/mapping/types/array.asciidoc | 9 +++++---- docs/reference/mapping/types/numeric.asciidoc | 5 +++++ docs/reference/mapping/types/text.asciidoc | 6 ++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/docs/reference/mapping/types.asciidoc b/docs/reference/mapping/types.asciidoc index bdfcf1128a061..f76e47f313460 100644 --- a/docs/reference/mapping/types.asciidoc +++ b/docs/reference/mapping/types.asciidoc @@ -17,8 +17,6 @@ string:: <> and <> [float] === Complex datatypes - -<>:: Array support does not require a dedicated `type` <>:: `object` for single JSON objects <>:: `nested` for arrays of JSON objects @@ -56,6 +54,10 @@ string:: <> and <> <>:: Allows an entire JSON object to be indexed as a single field. +[float] +[[types-array-handling]] +=== Array handling +In {es}, arrays do not require a dedicated field datatype. See <>. [float] === Multi-fields @@ -73,8 +75,6 @@ via the <> parameter. include::types/alias.asciidoc[] -include::types/array.asciidoc[] - include::types/binary.asciidoc[] include::types/range.asciidoc[] @@ -118,3 +118,5 @@ include::types/dense-vector.asciidoc[] include::types/sparse-vector.asciidoc[] include::types/search-as-you-type.asciidoc[] + +include::types/array.asciidoc[] diff --git a/docs/reference/mapping/types/array.asciidoc b/docs/reference/mapping/types/array.asciidoc index 385c61ebcd753..00a924e28dd62 100644 --- a/docs/reference/mapping/types/array.asciidoc +++ b/docs/reference/mapping/types/array.asciidoc @@ -1,9 +1,9 @@ [[array]] -=== Array datatype +=== Array handling -In Elasticsearch, there is no dedicated `array` type. Any field can contain -zero or more values by default, however, all values in the array must be of -the same datatype. For instance: +In Elasticsearch, there is no dedicated `array` datatype. Any field can contain +zero or more values by default, however, all values in the array must be of the +same datatype. For instance: * an array of strings: [ `"one"`, `"two"` ] * an array of integers: [ `1`, `2` ] @@ -81,6 +81,7 @@ GET my_index/_search <3> The second document contains no arrays, but can be indexed into the same fields. <4> The query looks for `elasticsearch` in the `tags` field, and matches both documents. +[[multi-value-fields-inverted-index]] .Multi-value fields and the inverted index **************************************************** diff --git a/docs/reference/mapping/types/numeric.asciidoc b/docs/reference/mapping/types/numeric.asciidoc index f2977957ff463..0e2b1d4eb791e 100644 --- a/docs/reference/mapping/types/numeric.asciidoc +++ b/docs/reference/mapping/types/numeric.asciidoc @@ -78,6 +78,11 @@ to help make a decision. |`half_float`|+2^-24^+ |+65504+ |+11+ / +3.31+ |======================================================================= +[[number-array]] +==== Array handling for numeric fields +You can use a numeric field to store an array of numbers. However, all values in +the array must be of the same datatype. See <>. + [[number-params]] ==== Parameters for numeric fields diff --git a/docs/reference/mapping/types/text.asciidoc b/docs/reference/mapping/types/text.asciidoc index ee972918988ad..17fc42e5722e5 100644 --- a/docs/reference/mapping/types/text.asciidoc +++ b/docs/reference/mapping/types/text.asciidoc @@ -30,6 +30,12 @@ PUT my_index -------------------------------- // CONSOLE +[[text-array]] +==== Array handling for text fields +You can use a `text` field to store an array of strings. See <>. + +[[text-multi-fields]] +==== Use a field as both text and keyword Sometimes it is useful to have both a full text (`text`) and a keyword (`keyword`) version of the same field: one for full text search and the other for aggregations and sorting. This can be achieved with From de16642ffc5c6633e48a5fe2c8b702765c337a6b Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Wed, 3 Jul 2019 11:21:47 -0400 Subject: [PATCH 2/3] Add detail to array section of datatypes page --- docs/reference/mapping/types.asciidoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/reference/mapping/types.asciidoc b/docs/reference/mapping/types.asciidoc index f76e47f313460..43cc3a410a812 100644 --- a/docs/reference/mapping/types.asciidoc +++ b/docs/reference/mapping/types.asciidoc @@ -57,7 +57,9 @@ string:: <> and <> [float] [[types-array-handling]] === Array handling -In {es}, arrays do not require a dedicated field datatype. See <>. +In {es}, arrays do not require a dedicated field datatype. Any field can contain +zero or more values by default, however, all values in the array must be of the +same datatype. See <>. [float] === Multi-fields From e8f6d429ec2b43a4a9e0b39177a88865576f9579 Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Mon, 8 Jul 2019 08:20:37 -0400 Subject: [PATCH 3/3] Updates to address feedback --- docs/reference/mapping/types.asciidoc | 6 +++--- docs/reference/mapping/types/array.asciidoc | 2 +- docs/reference/mapping/types/numeric.asciidoc | 5 ----- docs/reference/mapping/types/text.asciidoc | 4 ---- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/docs/reference/mapping/types.asciidoc b/docs/reference/mapping/types.asciidoc index 43cc3a410a812..b3ad39677d863 100644 --- a/docs/reference/mapping/types.asciidoc +++ b/docs/reference/mapping/types.asciidoc @@ -56,7 +56,7 @@ string:: <> and <> [float] [[types-array-handling]] -=== Array handling +=== Arrays In {es}, arrays do not require a dedicated field datatype. Any field can contain zero or more values by default, however, all values in the array must be of the same datatype. See <>. @@ -77,6 +77,8 @@ via the <> parameter. include::types/alias.asciidoc[] +include::types/array.asciidoc[] + include::types/binary.asciidoc[] include::types/range.asciidoc[] @@ -120,5 +122,3 @@ include::types/dense-vector.asciidoc[] include::types/sparse-vector.asciidoc[] include::types/search-as-you-type.asciidoc[] - -include::types/array.asciidoc[] diff --git a/docs/reference/mapping/types/array.asciidoc b/docs/reference/mapping/types/array.asciidoc index 00a924e28dd62..c7e3e273619be 100644 --- a/docs/reference/mapping/types/array.asciidoc +++ b/docs/reference/mapping/types/array.asciidoc @@ -1,5 +1,5 @@ [[array]] -=== Array handling +=== Arrays In Elasticsearch, there is no dedicated `array` datatype. Any field can contain zero or more values by default, however, all values in the array must be of the diff --git a/docs/reference/mapping/types/numeric.asciidoc b/docs/reference/mapping/types/numeric.asciidoc index 0e2b1d4eb791e..f2977957ff463 100644 --- a/docs/reference/mapping/types/numeric.asciidoc +++ b/docs/reference/mapping/types/numeric.asciidoc @@ -78,11 +78,6 @@ to help make a decision. |`half_float`|+2^-24^+ |+65504+ |+11+ / +3.31+ |======================================================================= -[[number-array]] -==== Array handling for numeric fields -You can use a numeric field to store an array of numbers. However, all values in -the array must be of the same datatype. See <>. - [[number-params]] ==== Parameters for numeric fields diff --git a/docs/reference/mapping/types/text.asciidoc b/docs/reference/mapping/types/text.asciidoc index 17fc42e5722e5..8ddecd88d08a9 100644 --- a/docs/reference/mapping/types/text.asciidoc +++ b/docs/reference/mapping/types/text.asciidoc @@ -30,10 +30,6 @@ PUT my_index -------------------------------- // CONSOLE -[[text-array]] -==== Array handling for text fields -You can use a `text` field to store an array of strings. See <>. - [[text-multi-fields]] ==== Use a field as both text and keyword Sometimes it is useful to have both a full text (`text`) and a keyword