From ecd8a036e345acb25b7974e3c95ebacc82a89361 Mon Sep 17 00:00:00 2001 From: Kofi B Date: Wed, 15 Jan 2025 23:04:17 -0800 Subject: [PATCH 1/2] Updated wording for clarity for new users --- docs/reference/mapping/types/array.asciidoc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/reference/mapping/types/array.asciidoc b/docs/reference/mapping/types/array.asciidoc index 2ffb191caf48e..2e7aa85c2cf49 100644 --- a/docs/reference/mapping/types/array.asciidoc +++ b/docs/reference/mapping/types/array.asciidoc @@ -14,9 +14,7 @@ same data type. For instance: [NOTE] ==================================================== -Arrays of objects do not work as you would expect: you cannot query each -object independently of the other objects in the array. If you need to be -able to do this then you should use the <> data type instead +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. To ensure queries match fields within the same object, use the <> data type instead of the <> data type. This is explained in more detail in <>. From be9b727386990b1c9d3e78d58533dc40c96a99d3 Mon Sep 17 00:00:00 2001 From: Kofi Bartlett Date: Sat, 18 Jan 2025 09:02:06 -0800 Subject: [PATCH 2/2] Added a detail on updating arrays --- docs/reference/mapping/types/array.asciidoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/reference/mapping/types/array.asciidoc b/docs/reference/mapping/types/array.asciidoc index 2e7aa85c2cf49..7a32178143147 100644 --- a/docs/reference/mapping/types/array.asciidoc +++ b/docs/reference/mapping/types/array.asciidoc @@ -79,3 +79,8 @@ GET my-index-000001/_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. + +Updating or appending an array is best done with a script using the <>. + + +