mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Until these are officially supported in new platform, it's best to not rely on this behavior. We can achieve roughly the same functionality with a GET request. Modifies the existing script accordingly, in case anyone's still using it. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
8d52178cbe
commit
8549ecf016
2 changed files with 9 additions and 20 deletions
|
@ -36,25 +36,14 @@ export const createReadIndexRoute = (
|
|||
const indexExists = await getIndexExists(callCluster, index);
|
||||
|
||||
if (indexExists) {
|
||||
// head request is used for if you want to get if the index exists
|
||||
// or not and it will return a content-length: 0 along with either a 200 or 404
|
||||
// depending on if the index exists or not.
|
||||
if (request.method.toLowerCase() === 'head') {
|
||||
return headers.response().code(200);
|
||||
} else {
|
||||
return headers.response({ name: index }).code(200);
|
||||
}
|
||||
return headers.response({ name: index }).code(200);
|
||||
} else {
|
||||
if (request.method.toLowerCase() === 'head') {
|
||||
return headers.response().code(404);
|
||||
} else {
|
||||
return headers
|
||||
.response({
|
||||
message: 'index for this space does not exist',
|
||||
status_code: 404,
|
||||
})
|
||||
.code(404);
|
||||
}
|
||||
return headers
|
||||
.response({
|
||||
message: 'index for this space does not exist',
|
||||
status_code: 404,
|
||||
})
|
||||
.code(404);
|
||||
}
|
||||
} catch (err) {
|
||||
const error = transformError(err);
|
||||
|
|
|
@ -10,7 +10,7 @@ set -e
|
|||
./check_env_variables.sh
|
||||
|
||||
# Example: ./signal_index_exists.sh
|
||||
curl -s -k --head \
|
||||
curl -s -k -f \
|
||||
-H 'Content-Type: application/json' \
|
||||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \
|
||||
${KIBANA_URL}${SPACE_URL}/api/detection_engine/index
|
||||
${KIBANA_URL}${SPACE_URL}/api/detection_engine/index > /dev/null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue