Skip to content

Commit fe819e0

Browse files
[DOCS] Updated wording for clarity for new users (#120257)
Co-authored-by: Liam Thompson <[email protected]>
1 parent 4640165 commit fe819e0

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

docs/reference/mapping/types/array.asciidoc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,16 @@ same data type. For instance:
1010
* an array of arrays: [ `1`, [ `2`, `3` ]] which is the equivalent of [ `1`, `2`, `3` ]
1111
* an array of objects: [ `{ "name": "Mary", "age": 12 }`, `{ "name": "John", "age": 10 }`]
1212

13-
.Arrays of objects
13+
.Arrays with `object` field type vs `nested` type
1414
[NOTE]
1515
====================================================
1616
17-
Arrays of objects do not work as you would expect: you cannot query each
18-
object independently of the other objects in the array. If you need to be
19-
able to do this then you should use the <<nested,`nested`>> data type instead
20-
of the <<object,`object`>> data type.
17+
Arrays of objects in Elasticsearch do not behave as you would expect: queries may match fields across different objects in the array, leading to unexpected results. By default, arrays of objects are <<nested-arrays-flattening-objects,flattened>>
18+
during indexing. To ensure queries match values within the same object, use the <<nested,`nested`>> data type instead of the <<object,`object`>> data type.
2119
22-
This is explained in more detail in <<nested>>.
20+
This behavior is explained in more detail in <<nested-arrays-flattening-objects, `nested`>>.
2321
====================================================
2422

25-
2623
When adding a field dynamically, the first value in the array determines the
2724
field `type`. All subsequent values must be of the same data type or it must
2825
at least be possible to <<coerce,coerce>> subsequent values to the same
@@ -81,3 +78,10 @@ GET my-index-000001/_search
8178
<3> The second document contains no arrays, but can be indexed into the same fields.
8279
<4> The query looks for `elasticsearch` in the `tags` field, and matches both documents.
8380

81+
[TIP]
82+
====
83+
You can modify arrays using the <<update-api-example,update API>>.
84+
====
85+
86+
87+

0 commit comments

Comments
 (0)