Browse Source

Docs: CONSOLEify some more docs

These need to be CONSOLEified *now* because we're starting to
require Content-Type headers and they didn't have any.

* cluster/reroute: Marked as CONSOLE but skipped because the docs
build runs with a single node.
* docs/bulk: Marked as NOTCONSOLE because the snippets describe
either examples or `curl` commands. Fixed the `curl` command to
include the `Content-Type` header.
* query-dsl/terms-query: Marked as CONSOLE.
* search/request/rescore: Marked as CONSOLE. Fixed deprecated
syntax.

Relates #23001
Relates #18160
Nik Everett 8 years ago
parent
commit
0e98c9107a

+ 0 - 4
docs/build.gradle

@@ -90,12 +90,10 @@ buildRestTests.expectedUnconvertedCandidates = [
   'reference/cluster/nodes-info.asciidoc',
   'reference/cluster/nodes-stats.asciidoc',
   'reference/cluster/pending.asciidoc',
-  'reference/cluster/reroute.asciidoc',
   'reference/cluster/state.asciidoc',
   'reference/cluster/stats.asciidoc',
   'reference/cluster/tasks.asciidoc',
   'reference/cluster/update-settings.asciidoc',
-  'reference/docs/bulk.asciidoc',
   'reference/docs/delete-by-query.asciidoc',
   'reference/docs/delete.asciidoc',
   'reference/docs/index_.asciidoc',
@@ -135,13 +133,11 @@ buildRestTests.expectedUnconvertedCandidates = [
   'reference/query-dsl/exists-query.asciidoc',
   'reference/query-dsl/function-score-query.asciidoc',
   'reference/query-dsl/geo-shape-query.asciidoc',
-  'reference/query-dsl/terms-query.asciidoc',
   'reference/search/field-stats.asciidoc',
   'reference/search/multi-search.asciidoc',
   'reference/search/profile.asciidoc',
   'reference/search/request/highlighting.asciidoc',
   'reference/search/request/inner-hits.asciidoc',
-  'reference/search/request/rescore.asciidoc',
   'reference/search/search-template.asciidoc',
 ]
 

+ 13 - 9
docs/reference/cluster/reroute.asciidoc

@@ -11,22 +11,26 @@ Here is a short example of how a simple reroute API call:
 
 [source,js]
 --------------------------------------------------
-curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
-    "commands" : [ {
-        "move" :
-            {
-              "index" : "test", "shard" : 0,
-              "from_node" : "node1", "to_node" : "node2"
+POST /_cluster/reroute
+{
+    "commands" : [
+        {
+            "move" : {
+                "index" : "test", "shard" : 0,
+                "from_node" : "node1", "to_node" : "node2"
             }
         },
         {
           "allocate_replica" : {
-              "index" : "test", "shard" : 1, "node" : "node3"
+                "index" : "test", "shard" : 1,
+                "node" : "node3"
           }
         }
     ]
-}'
+}
 --------------------------------------------------
+// CONSOLE
+// TEST[skip:doc tests run with only a single node]
 
 An important aspect to remember is the fact that once when an allocation
 occurs, the cluster will aim at re-balancing its state back to an even
@@ -115,4 +119,4 @@ file which doesn't exist on all nodes.
 
 Once the problem has been corrected, allocation can be manually retried by
 calling the <<cluster-reroute,`_reroute`>> API with `?retry_failed`, which
-will attempt a single retry round for these shards.
+will attempt a single retry round for these shards.

+ 5 - 2
docs/reference/docs/bulk.asciidoc

@@ -34,6 +34,7 @@ optional_source\n
 action_and_meta_data\n
 optional_source\n
 --------------------------------------------------
+// NOTCONSOLE
 
 *NOTE*: the final line of data must end with a newline character `\n`.
 
@@ -56,9 +57,11 @@ newlines. Example:
 $ cat requests
 { "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
 { "field1" : "value1" }
-$ curl -s -XPOST localhost:9200/_bulk --data-binary "@requests"; echo
+$ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo
 {"took":7, "errors": false, "items":[{"index":{"_index":"test","_type":"type1","_id":"1","_version":1,"result":"created","forced_refresh":false}}]}
 --------------------------------------------------
+// NOTCONSOLE
+// Not converting to console because this shows how curl works
 
 Because this format uses literal `\n`'s as delimiters, please be sure
 that the JSON actions and sources are not pretty printed. Here is an
@@ -212,7 +215,7 @@ operation based on the `_parent` / `_routing` mapping.
 
 When making bulk calls, you can set the `wait_for_active_shards`
 parameter to require a minimum number of shard copies to be active
-before starting to process the bulk request. See 
+before starting to process the bulk request. See
 <<index-wait-for-active-shards,here>> for further details and a usage
 example.
 

+ 4 - 2
docs/reference/query-dsl/terms-query.asciidoc

@@ -97,7 +97,8 @@ inner objects, for example:
 
 [source,js]
 --------------------------------------------------
-curl -XPUT localhost:9200/users/user/2 -d '{
+PUT /users/user/2
+{
  "followers" : [
    {
      "id" : "1"
@@ -106,7 +107,8 @@ curl -XPUT localhost:9200/users/user/2 -d '{
      "id" : "2"
    }
  ]
-}'
+}
 --------------------------------------------------
+// CONSOLE
 
 In which case, the lookup path will be `followers.id`.

+ 18 - 18
docs/reference/search/request/rescore.asciidoc

@@ -41,13 +41,13 @@ For example:
 
 [source,js]
 --------------------------------------------------
-curl -s -XPOST 'localhost:9200/_search' -d '{
+POST /_search
+{
    "query" : {
       "match" : {
-         "field1" : {
+         "message" : {
             "operator" : "or",
-            "query" : "the quick brown",
-            "type" : "boolean"
+            "query" : "the quick brown"
          }
       }
    },
@@ -55,10 +55,9 @@ curl -s -XPOST 'localhost:9200/_search' -d '{
       "window_size" : 50,
       "query" : {
          "rescore_query" : {
-            "match" : {
-               "field1" : {
+            "match_phrase" : {
+               "message" : {
                   "query" : "the quick brown",
-                  "type" : "phrase",
                   "slop" : 2
                }
             }
@@ -68,8 +67,9 @@ curl -s -XPOST 'localhost:9200/_search' -d '{
       }
    }
 }
-'
 --------------------------------------------------
+// CONSOLE
+// TEST[setup:twitter]
 
 The way the scores are combined can be controlled with the `score_mode`:
 [cols="<,<",options="header",]
@@ -86,15 +86,16 @@ for <<query-dsl-function-score-query,`function query`>> rescores.
 ==== Multiple Rescores
 
 It is also possible to execute multiple rescores in sequence:
+
 [source,js]
 --------------------------------------------------
-curl -s -XPOST 'localhost:9200/_search' -d '{
+POST /_search
+{
    "query" : {
       "match" : {
-         "field1" : {
+         "message" : {
             "operator" : "or",
-            "query" : "the quick brown",
-            "type" : "boolean"
+            "query" : "the quick brown"
          }
       }
    },
@@ -102,10 +103,9 @@ curl -s -XPOST 'localhost:9200/_search' -d '{
       "window_size" : 100,
       "query" : {
          "rescore_query" : {
-            "match" : {
-               "field1" : {
+            "match_phrase" : {
+               "message" : {
                   "query" : "the quick brown",
-                  "type" : "phrase",
                   "slop" : 2
                }
             }
@@ -121,8 +121,7 @@ curl -s -XPOST 'localhost:9200/_search' -d '{
             "function_score" : {
                "script_score": {
                   "script": {
-                    "lang": "painless",
-                    "inline": "Math.log10(doc['numeric'].value + 2)"
+                    "inline": "Math.log10(doc.likes.value + 2)"
                   }
                }
             }
@@ -130,8 +129,9 @@ curl -s -XPOST 'localhost:9200/_search' -d '{
       }
    } ]
 }
-'
 --------------------------------------------------
+// CONSOLE
+// TEST[setup:twitter]
 
 The first one gets the results of the query then the second one gets the
 results of the first, etc.  The second rescore will "see" the sorting done