From d685847b73f0c58edb4adaabbbfa8537de73e4fb Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Tue, 23 Aug 2016 13:32:14 +0200 Subject: [PATCH] Use `refresh=true` in mapping/fields examples (#20120) Fix field examples to make documents actually visible This commit adds refresh calls to field examples an removes not working `_routing` and `_field_names` script access. Closes #20118 --- .../mapping/fields/field-names-field.asciidoc | 15 +++------------ docs/reference/mapping/fields/id-field.asciidoc | 2 +- .../reference/mapping/fields/index-field.asciidoc | 2 +- .../mapping/fields/parent-field.asciidoc | 2 +- .../mapping/fields/routing-field.asciidoc | 14 ++------------ docs/reference/mapping/fields/type-field.asciidoc | 2 +- docs/reference/mapping/fields/uid-field.asciidoc | 2 +- 7 files changed, 10 insertions(+), 29 deletions(-) diff --git a/docs/reference/mapping/fields/field-names-field.asciidoc b/docs/reference/mapping/fields/field-names-field.asciidoc index cf8c6398d2e..815606fb7bd 100644 --- a/docs/reference/mapping/fields/field-names-field.asciidoc +++ b/docs/reference/mapping/fields/field-names-field.asciidoc @@ -6,7 +6,7 @@ contains any value other than `null`. This field is used by the <> query to find documents that either have or don't have any non-+null+ value for a particular field. -The value of the `_field_name` field is accessible in queries and scripts: +The value of the `_field_name` field is accessible in queries: [source,js] -------------------------- @@ -16,7 +16,7 @@ PUT my_index/my_type/1 "title": "This is a document" } -PUT my_index/my_type/1 +PUT my_index/my_type/2?refresh=true { "title": "This is another document", "body": "This document has a body" @@ -28,19 +28,10 @@ GET my_index/_search "terms": { "_field_names": [ "title" ] <1> } - }, - "script_fields": { - "Field names": { - "script": { - "lang": "painless", - "inline": "doc['_field_names']" <2> - } - } } } -------------------------- // CONSOLE -<1> Querying on the `_field_names` field (also see the <> query) -<2> Accessing the `_field_names` field in scripts +<1> Querying on the `_field_names` field (also see the <> query) \ No newline at end of file diff --git a/docs/reference/mapping/fields/id-field.asciidoc b/docs/reference/mapping/fields/id-field.asciidoc index c640b561571..94c95a8bbeb 100644 --- a/docs/reference/mapping/fields/id-field.asciidoc +++ b/docs/reference/mapping/fields/id-field.asciidoc @@ -19,7 +19,7 @@ PUT my_index/my_type/1 "text": "Document with ID 1" } -PUT my_index/my_type/2 +PUT my_index/my_type/2&refresh=true { "text": "Document with ID 2" } diff --git a/docs/reference/mapping/fields/index-field.asciidoc b/docs/reference/mapping/fields/index-field.asciidoc index 599fedba62c..cd285c42557 100644 --- a/docs/reference/mapping/fields/index-field.asciidoc +++ b/docs/reference/mapping/fields/index-field.asciidoc @@ -21,7 +21,7 @@ PUT index_1/my_type/1 "text": "Document in index 1" } -PUT index_2/my_type/2 +PUT index_2/my_type/2?refresh=true { "text": "Document in index 2" } diff --git a/docs/reference/mapping/fields/parent-field.asciidoc b/docs/reference/mapping/fields/parent-field.asciidoc index 30b2e1a2086..a49c7f8e399 100644 --- a/docs/reference/mapping/fields/parent-field.asciidoc +++ b/docs/reference/mapping/fields/parent-field.asciidoc @@ -28,7 +28,7 @@ PUT my_index/my_child/2?parent=1 <3> "text": "This is a child document" } -PUT my_index/my_child/3?parent=1 <3> +PUT my_index/my_child/3?parent=1&refresh=true <3> { "text": "This is another child document" } diff --git a/docs/reference/mapping/fields/routing-field.asciidoc b/docs/reference/mapping/fields/routing-field.asciidoc index c8a92de1368..bbdef3370c4 100644 --- a/docs/reference/mapping/fields/routing-field.asciidoc +++ b/docs/reference/mapping/fields/routing-field.asciidoc @@ -14,7 +14,7 @@ value per document. For instance: [source,js] ------------------------------ -PUT my_index/my_type/1?routing=user1 <1> +PUT my_index/my_type/1?routing=user1&refresh=true <1> { "title": "This is a document" } @@ -29,7 +29,7 @@ GET my_index/my_type/1?routing=user1 <2> <>, <>, or <> the document. -The value of the `_routing` field is accessible in queries and scripts: +The value of the `_routing` field is accessible in queries: [source,js] -------------------------- @@ -39,22 +39,12 @@ GET my_index/_search "terms": { "_routing": [ "user1" ] <1> } - }, - "script_fields": { - "Routing value": { - "script": { - "lang": "painless", - "inline": "doc['_routing']" <2> - } - } } } -------------------------- // CONSOLE <1> Querying on the `_routing` field (also see the <>) -<2> Accessing the `_routing` field in scripts - ==== Searching with custom routing diff --git a/docs/reference/mapping/fields/type-field.asciidoc b/docs/reference/mapping/fields/type-field.asciidoc index fecc0143e94..a84b2508de4 100644 --- a/docs/reference/mapping/fields/type-field.asciidoc +++ b/docs/reference/mapping/fields/type-field.asciidoc @@ -16,7 +16,7 @@ PUT my_index/type_1/1 "text": "Document with type 1" } -PUT my_index/type_2/2 +PUT my_index/type_2/2?refresh=true { "text": "Document with type 2" } diff --git a/docs/reference/mapping/fields/uid-field.asciidoc b/docs/reference/mapping/fields/uid-field.asciidoc index 82095160646..bad9eb4768b 100644 --- a/docs/reference/mapping/fields/uid-field.asciidoc +++ b/docs/reference/mapping/fields/uid-field.asciidoc @@ -16,7 +16,7 @@ PUT my_index/my_type/1 "text": "Document with ID 1" } -PUT my_index/my_type/2 +PUT my_index/my_type/2?refresh=true { "text": "Document with ID 2" }