mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 17:34:17 -04:00
Renamed all AUTOSENSE snippets to CONSOLE (#18210)
This commit is contained in:
parent
2528934411
commit
3f594089c2
95 changed files with 281 additions and 281 deletions
|
@ -79,7 +79,7 @@ GET my_index/_search
|
|||
}
|
||||
}
|
||||
-------------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
|
||||
|
||||
[float]
|
||||
|
@ -113,7 +113,7 @@ GET my_index/_search
|
|||
}
|
||||
}
|
||||
-------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
|
||||
Doc-values can only return "simple" field values like numbers, dates, geo-
|
||||
points, terms, etc, or arrays of these values if the field is multi-valued.
|
||||
|
@ -211,7 +211,7 @@ GET my_index/_search
|
|||
}
|
||||
}
|
||||
-------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
<1> The `title` field is not stored and so cannot be used with the `_fields[]` syntax.
|
||||
<2> The `title` field can still be accessed from the `_source`.
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ PUT hockey/player/_bulk?refresh
|
|||
{"index":{"_id":11}}
|
||||
{"first":"joe","last":"colborne","goals":[3,18,13],"assists":[6,20,24],"gp":[26,67,82]}
|
||||
----------------------------------------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
// TESTSETUP
|
||||
|
||||
[float]
|
||||
|
@ -92,7 +92,7 @@ GET hockey/_search
|
|||
}
|
||||
}
|
||||
----------------------------------------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
|
||||
Alternatively, you could do the same thing using a script field instead of a function score:
|
||||
|
||||
|
@ -113,7 +113,7 @@ GET hockey/_search
|
|||
}
|
||||
}
|
||||
----------------------------------------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
|
||||
The following example uses a Painless script to sort the players by their combined first and last names. The names are accessed using
|
||||
`input.doc['first'].value` and `input.doc['last'].value`.
|
||||
|
@ -137,7 +137,7 @@ GET hockey/_search
|
|||
}
|
||||
}
|
||||
----------------------------------------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
|
||||
[float]
|
||||
=== Updating Fields with Painless
|
||||
|
@ -161,7 +161,7 @@ GET hockey/_search
|
|||
}
|
||||
}
|
||||
----------------------------------------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
|
||||
To change player 1's last name to `hockey`, simply set `input.ctx._source.last` to the new value:
|
||||
|
||||
|
@ -178,7 +178,7 @@ POST hockey/player/1/_update
|
|||
}
|
||||
}
|
||||
----------------------------------------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
|
||||
You can also add fields to a document. For example, this script adds a new field that contains
|
||||
the player's nickname, _hockey_.
|
||||
|
@ -197,7 +197,7 @@ POST hockey/player/1/_update
|
|||
}
|
||||
}
|
||||
----------------------------------------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
|
||||
[float]
|
||||
=== Writing Type-Safe Scripts to Improve Performance
|
||||
|
@ -229,7 +229,7 @@ GET hockey/_search
|
|||
}
|
||||
}
|
||||
----------------------------------------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
|
||||
[[painless-api]]
|
||||
[float]
|
||||
|
|
|
@ -41,7 +41,7 @@ GET my_index/_search
|
|||
}
|
||||
}
|
||||
-------------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
|
||||
|
||||
[float]
|
||||
|
@ -191,7 +191,7 @@ POST _scripts/groovy/calculate-score
|
|||
"script": "log(_score * 2) + my_modifier"
|
||||
}
|
||||
-----------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
|
||||
This same script can be retrieved with:
|
||||
|
||||
|
@ -199,7 +199,7 @@ This same script can be retrieved with:
|
|||
-----------------------------------
|
||||
GET _scripts/groovy/calculate-score
|
||||
-----------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
// TEST[continued]
|
||||
|
||||
Stored scripts can be used by specifying the `lang` and `id` parameters as follows:
|
||||
|
@ -221,7 +221,7 @@ GET _search
|
|||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
// TEST[continued]
|
||||
|
||||
And deleted with:
|
||||
|
@ -230,7 +230,7 @@ And deleted with:
|
|||
-----------------------------------
|
||||
DELETE _scripts/groovy/calculate-score
|
||||
-----------------------------------
|
||||
// AUTOSENSE
|
||||
// CONSOLE
|
||||
// TEST[continued]
|
||||
|
||||
NOTE: The size of stored scripts is limited to 65,535 bytes. This can be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue