Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Indexed scripts: make sure headers are handed over to internal reques…
…ts and streamline versioning support The get, put and delete indexed script apis map to get, index and delete api and internally create those corresponding requests. We need to make sure that the original headers are handed over to the new request by passing the original request in the constructor when creating the new one. Also streamlined the support for version and version_type in the REST layer since the parameters were not consistently parsed and set to the internal java API requests. Modified the REST delete template and delete script actions to make use of a client instead of using the `ScriptService` directly. Closes #7569
- Loading branch information
Showing
19 changed files
with
355 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
--- | ||
"External version": | ||
|
||
- do: | ||
put_script: | ||
lang: groovy | ||
id: 1 | ||
body: { "script": "_score * doc[\"myParent.weight\"].value" } | ||
version_type: external | ||
version: 0 | ||
|
||
- match: { _version: 0 } | ||
|
||
- do: | ||
put_script: | ||
lang: groovy | ||
id: 1 | ||
body: { "script": "_score * doc[\"myParent.weight\"].value" } | ||
version_type: external | ||
version: 5 | ||
|
||
- match: { _version: 5 } | ||
|
||
- do: | ||
catch: conflict | ||
get_script: | ||
lang: groovy | ||
id: 1 | ||
version: 3 | ||
|
||
- do: | ||
catch: conflict | ||
delete_script: | ||
lang: groovy | ||
id: 1 | ||
version: 3 | ||
|
||
- do: | ||
get_script: | ||
lang: groovy | ||
id: 1 | ||
version: 5 | ||
version_type: external | ||
- is_true: script | ||
|
||
- do: | ||
get_script: | ||
lang: groovy | ||
id: 1 | ||
version: 5 | ||
version_type: external_gte | ||
- is_true: script | ||
|
||
- do: | ||
catch: conflict | ||
get_script: | ||
lang: groovy | ||
id: 1 | ||
version: 10 | ||
version_type: external_gte | ||
|
||
- do: | ||
catch: conflict | ||
delete_script: | ||
lang: groovy | ||
id: 1 | ||
version: 3 | ||
version_type: external | ||
|
||
- do: | ||
get_script: | ||
lang: groovy | ||
id: 1 | ||
version: 5 | ||
version_type: force | ||
- is_true: script | ||
|
||
- do: | ||
get_script: | ||
lang: groovy | ||
id: 1 | ||
version: 10 | ||
version_type: force | ||
- is_true: script | ||
|
||
- do: | ||
catch: conflict | ||
put_script: | ||
lang: groovy | ||
id: 1 | ||
body: { "script": "_score * doc[\"myParent.weight\"].value" } | ||
version_type: external | ||
version: 5 | ||
|
||
- do: | ||
catch: conflict | ||
put_script: | ||
lang: groovy | ||
id: 1 | ||
body: { "script": "_score * doc[\"myParent.weight\"].value" } | ||
version_type: external | ||
version: 0 | ||
|
||
- do: | ||
put_script: | ||
lang: groovy | ||
id: 1 | ||
body: { "script": "_score * doc[\"myParent.weight\"].value" } | ||
version_type: external | ||
version: 6 | ||
|
||
- match: { _version: 6} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.