Skip to content

Commit

Permalink
fixes for v7 ES for warnings thrown #241
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Dec 28, 2018
1 parent 7da718a commit 1f8b5ee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion tests/testthat/test-search.r
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,15 @@ test_that("search terminate_after parameter works", {
test_that("getting json data back from search works", {

suppressMessages(require('jsonlite'))
f <- Search(x, index="shakespeare", type="scene", raw=TRUE)

if (es_version(x) >= 700) {
expect_warning(
f <- Search(x, index="shakespeare", type="scene", raw=TRUE),
"Specifying types in search requests is deprecated"
)
} else {
f <- Search(x, index="shakespeare", type="scene", raw=TRUE)
}
expect_is(f, "character")
expect_true(jsonlite::validate(f))
expect_is(jsonlite::fromJSON(f), "list")
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-search_template.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,19 @@ body2 <- '{
}
}'

if (es_version(x) >= 700) {
body1 <- sub("inline", "source", body1)
body2 <- sub("inline", "source", body2)
}

iris2 <- stats::setNames(iris, gsub("\\.", "_", names(iris)))

test_that("basic Search_template works", {
if (es_version(x) < 200) skip('feature not in this ES version')

if (index_exists(x, "iris")) invisible(suppressMessages(index_delete(x, "iris")))
invisible(docs_bulk(x, iris2, "iris"))

a <- Search_template(x, body = body1)
expect_equal(names(a), c('took','timed_out','_shards','hits'))
expect_is(a, "list")
Expand Down

0 comments on commit 1f8b5ee

Please sign in to comment.