Skip to content

Commit 8acc581

Browse files
committed
merge in man file change from index to indices #247 #233
2 parents 01709af + a5053c2 commit 8acc581

File tree

2 files changed

+69
-69
lines changed

2 files changed

+69
-69
lines changed

R/index.R

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
#' @references
44
#' <https://www.elastic.co/guide/en/elasticsearch/reference/current/indices.html>
55
#' @author Scott Chamberlain <myrmecocystus@@gmail.com>
6-
#' @name index
6+
#' @name indices
77
#'
88
#' @param conn an Elasticsearch connection object, see [connect()]
99
#' @param index (character) A character vector of index names
10-
#' @param features (character) A single feature. One of settings, mappings, or
10+
#' @param features (character) A single feature. One of settings, mappings, or
1111
#' aliases
1212
#' @param raw If `TRUE` (default), data is parsed to list. If FALSE, then raw JSON.
1313
#' @param ... Curl args passed on to [crul::HttpClient]
1414
#' @param verbose If `TRUE` (default) the url call used printed to console.
1515
#' @param fields (character) Fields to add.
16-
#' @param metric (character) A character vector of metrics to display. Possible
17-
#' values: "_all", "completion", "docs", "fielddata", "filter_cache", "flush",
18-
#' "get", "id_cache", "indexing", "merge", "percolate", "refresh", "search",
16+
#' @param metric (character) A character vector of metrics to display. Possible
17+
#' values: "_all", "completion", "docs", "fielddata", "filter_cache", "flush",
18+
#' "get", "id_cache", "indexing", "merge", "percolate", "refresh", "search",
1919
#' "segments", "store", "warmer".
2020
#' @param completion_fields (character) A character vector of fields for completion metric
2121
#' (supports wildcards)
@@ -83,15 +83,15 @@
8383
#' function. See
8484
#' https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html
8585
#' for all the options.
86-
#'
86+
#'
8787
#' **index settings**: See
8888
#' https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html
8989
#' for the *static* and *dynamic* settings you can set on indices.
9090
#'
9191
#' @examples \dontrun{
9292
#' # connection setup
9393
#' (x <- connect())
94-
#'
94+
#'
9595
#' # get information on an index
9696
#' index_get(x, index='shakespeare')
9797
#' ## this one is the same as running index_settings('shakespeare')
@@ -208,18 +208,18 @@
208208
#' index_upgrade(x, c('plos','gbif'))
209209
#' }
210210
#'
211-
#' # Performs the analysis process on a text and return the tokens breakdown
211+
#' # Performs the analysis process on a text and return the tokens breakdown
212212
#' # of the text
213213
#' index_analyze(x, text = 'this is a test', analyzer='standard')
214214
#' index_analyze(x, text = 'this is a test', analyzer='whitespace')
215215
#' index_analyze(x, text = 'this is a test', analyzer='stop')
216-
#' index_analyze(x, text = 'this is a test', tokenizer='keyword',
216+
#' index_analyze(x, text = 'this is a test', tokenizer='keyword',
217217
#' filters='lowercase')
218-
#' index_analyze(x, text = 'this is a test', tokenizer='keyword',
218+
#' index_analyze(x, text = 'this is a test', tokenizer='keyword',
219219
#' filters='lowercase', char_filters='html_strip')
220-
#' index_analyze(x, text = 'this is a test', index = 'plos',
220+
#' index_analyze(x, text = 'this is a test', index = 'plos',
221221
#' analyzer="standard")
222-
#' index_analyze(x, text = 'this is a test', index = 'shakespeare',
222+
#' index_analyze(x, text = 'this is a test', index = 'shakespeare',
223223
#' analyzer="standard")
224224
#'
225225
#' ## NGram tokenizer
@@ -244,7 +244,7 @@
244244
#' }'
245245
#' if (index_exists(x, "shakespeare2")) index_delete(x, "shakespeare2")
246246
#' tokenizer_set(x, index = "shakespeare2", body=body)
247-
#' index_analyze(x, text = "art thouh", index = "shakespeare2",
247+
#' index_analyze(x, text = "art thouh", index = "shakespeare2",
248248
#' analyzer='my_ngram_analyzer')
249249
#'
250250
#' # Explicitly flush one or more indices.
@@ -278,7 +278,7 @@
278278
NULL
279279

280280
#' @export
281-
#' @rdname index
281+
#' @rdname indices
282282
index_get <- function(conn, index=NULL, features=NULL, raw=FALSE, verbose=TRUE, ...) {
283283
is_conn(conn)
284284
conn$stop_es_version(120, "index_get")
@@ -287,7 +287,7 @@ index_get <- function(conn, index=NULL, features=NULL, raw=FALSE, verbose=TRUE,
287287
}
288288

289289
#' @export
290-
#' @rdname index
290+
#' @rdname indices
291291
index_exists <- function(conn, index, ...) {
292292
is_conn(conn)
293293
url <- file.path(conn$make_url(), esc(index))
@@ -296,7 +296,7 @@ index_exists <- function(conn, index, ...) {
296296
}
297297

298298
#' @export
299-
#' @rdname index
299+
#' @rdname indices
300300
index_delete <- function(conn, index, raw=FALSE, verbose=TRUE, ...) {
301301
is_conn(conn)
302302
url <- paste0(conn$make_url(), "/", esc(index))
@@ -308,16 +308,16 @@ index_delete <- function(conn, index, raw=FALSE, verbose=TRUE, ...) {
308308
}
309309

310310
#' @export
311-
#' @rdname index
311+
#' @rdname indices
312312
index_create <- function(conn, index=NULL, body=NULL, raw=FALSE, verbose=TRUE, ...) {
313313
is_conn(conn)
314314
url <- conn$make_url()
315315
es_PUT(conn, paste0(url, "/", esc(index)), body = body, ...)
316316
}
317317

318318
#' @export
319-
#' @rdname index
320-
index_recreate <- function(conn, index=NULL, body=NULL, raw=FALSE, verbose=TRUE,
319+
#' @rdname indices
320+
index_recreate <- function(conn, index=NULL, body=NULL, raw=FALSE, verbose=TRUE,
321321
...) {
322322
is_conn(conn)
323323
if (index_exists(conn, index, ...)) {
@@ -329,40 +329,40 @@ index_recreate <- function(conn, index=NULL, body=NULL, raw=FALSE, verbose=TRUE,
329329
}
330330

331331
#' @export
332-
#' @rdname index
332+
#' @rdname indices
333333
index_close <- function(conn, index, ...) {
334334
is_conn(conn)
335335
close_open(conn, index, "_close", ...)
336336
}
337337

338338
#' @export
339-
#' @rdname index
339+
#' @rdname indices
340340
index_open <- function(conn, index, ...) {
341341
is_conn(conn)
342342
close_open(conn, index, "_open", ...)
343343
}
344344

345345
#' @export
346-
#' @rdname index
347-
index_stats <- function(conn, index=NULL, metric=NULL, completion_fields=NULL,
348-
fielddata_fields=NULL, fields=NULL, groups=NULL,
346+
#' @rdname indices
347+
index_stats <- function(conn, index=NULL, metric=NULL, completion_fields=NULL,
348+
fielddata_fields=NULL, fields=NULL, groups=NULL,
349349
level='indices', ...) {
350350
is_conn(conn)
351351
url <- conn$make_url()
352352
url <- if (is.null(index)) {
353-
file.path(url, "_stats")
353+
file.path(url, "_stats")
354354
} else {
355355
file.path(url, esc(cl(index)), "_stats")
356356
}
357357
url <- if (!is.null(metric)) file.path(url, cl(metric)) else url
358-
args <- ec(list(completion_fields = completion_fields,
358+
args <- ec(list(completion_fields = completion_fields,
359359
fielddata_fields = fielddata_fields,
360360
fields = fields, groups = groups, level = level))
361361
es_GET_(conn, url, args, ...)
362362
}
363363

364364
#' @export
365-
#' @rdname index
365+
#' @rdname indices
366366
index_settings <- function(conn, index="_all", ...) {
367367
is_conn(conn)
368368
url <- conn$make_url()
@@ -375,12 +375,12 @@ index_settings <- function(conn, index="_all", ...) {
375375
}
376376

377377
#' @export
378-
#' @rdname index
378+
#' @rdname indices
379379
index_settings_update <- function(conn, index=NULL, body, ...) {
380380
is_conn(conn)
381381
url <- conn$make_url()
382382
url <- if (is.null(index)) {
383-
file.path(url, "_settings")
383+
file.path(url, "_settings")
384384
} else {
385385
file.path(url, esc(cl(index)), "_settings")
386386
}
@@ -389,29 +389,29 @@ index_settings_update <- function(conn, index=NULL, body, ...) {
389389
}
390390

391391
#' @export
392-
#' @rdname index
392+
#' @rdname indices
393393
index_segments <- function(conn, index = NULL, ...) {
394394
is_conn(conn)
395395
es_GET_wrap1(conn, index, "_segments", ...)
396396
}
397397

398398
#' @export
399-
#' @rdname index
400-
index_recovery <- function(conn, index = NULL, detailed = FALSE, active_only = FALSE,
399+
#' @rdname indices
400+
index_recovery <- function(conn, index = NULL, detailed = FALSE, active_only = FALSE,
401401
...) {
402402
is_conn(conn)
403403
conn$stop_es_version(110, "index_recovery")
404-
args <- ec(list(detailed = as_log(detailed),
404+
args <- ec(list(detailed = as_log(detailed),
405405
active_only = as_log(active_only)))
406406
es_GET_wrap1(conn, index, "_recovery", args, ...)
407407
}
408408

409409
#' @export
410-
#' @rdname index
411-
index_optimize <- function(conn, index = NULL, max_num_segments = NULL,
410+
#' @rdname indices
411+
index_optimize <- function(conn, index = NULL, max_num_segments = NULL,
412412
only_expunge_deletes = FALSE,
413413
flush = TRUE, wait_for_merge = TRUE, ...) {
414-
414+
415415
is_conn(conn)
416416
if (conn$es_ver() >= 500) {
417417
stop("optimize is gone in ES >= v5, see ?index_forcemerge")
@@ -425,10 +425,10 @@ index_optimize <- function(conn, index = NULL, max_num_segments = NULL,
425425
}
426426

427427
#' @export
428-
#' @rdname index
429-
index_forcemerge <- function(conn, index = NULL, max_num_segments = NULL,
428+
#' @rdname indices
429+
index_forcemerge <- function(conn, index = NULL, max_num_segments = NULL,
430430
only_expunge_deletes = FALSE, flush = TRUE, ...) {
431-
431+
432432
is_conn(conn)
433433
if (conn$es_ver() < 500) {
434434
stop("forcemerge is only in ES >= v5, see ?index_optimize")
@@ -442,7 +442,7 @@ index_forcemerge <- function(conn, index = NULL, max_num_segments = NULL,
442442
}
443443

444444
#' @export
445-
#' @rdname index
445+
#' @rdname indices
446446
index_upgrade <- function(conn, index = NULL, wait_for_completion = FALSE, ...) {
447447
is_conn(conn)
448448
conn$stop_es_version(120, "index_get")
@@ -455,9 +455,9 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/reindex-upgrade.
455455
}
456456

457457
#' @export
458-
#' @rdname index
459-
index_analyze <- function(conn, text=NULL, field=NULL, index=NULL, analyzer=NULL,
460-
tokenizer=NULL, filters=NULL, char_filters=NULL,
458+
#' @rdname indices
459+
index_analyze <- function(conn, text=NULL, field=NULL, index=NULL, analyzer=NULL,
460+
tokenizer=NULL, filters=NULL, char_filters=NULL,
461461
body=list(), ...) {
462462
is_conn(conn)
463463
url <- conn$make_url()
@@ -466,43 +466,43 @@ index_analyze <- function(conn, text=NULL, field=NULL, index=NULL, analyzer=NULL
466466
} else {
467467
url <- sprintf("%s/_analyze", url)
468468
}
469-
469+
470470
if (conn$es_ver() >= 500) {
471-
body <- ec(list(text = text, analyzer = analyzer, tokenizer = tokenizer,
472-
filter = I(filters), char_filter = I(char_filters),
471+
body <- ec(list(text = text, analyzer = analyzer, tokenizer = tokenizer,
472+
filter = I(filters), char_filter = I(char_filters),
473473
field = field))
474474
args <- list()
475475
} else {
476476
body <- list()
477-
args <- ec(list(text = text, analyzer = analyzer, tokenizer = tokenizer,
478-
filters = I(filters), char_filters = I(char_filters),
477+
args <- ec(list(text = text, analyzer = analyzer, tokenizer = tokenizer,
478+
filters = I(filters), char_filters = I(char_filters),
479479
field = field))
480480
}
481-
481+
482482
analyze_POST(conn, url, args, body, ...)$tokens
483483
}
484484

485485
#' @export
486-
#' @rdname index
487-
index_flush <- function(conn, index=NULL, force=FALSE, full=FALSE,
486+
#' @rdname indices
487+
index_flush <- function(conn, index=NULL, force=FALSE, full=FALSE,
488488
wait_if_ongoing=FALSE, ...) {
489-
489+
490490
is_conn(conn)
491491
url <- conn$make_url()
492492
if (!is.null(index)) {
493493
url <- sprintf("%s/%s/_flush", url, esc(cl(index)))
494494
} else {
495495
url <- sprintf("%s/_flush", url)
496496
}
497-
args <- ec(list(force = as_log(force), full = as_log(full),
497+
args <- ec(list(force = as_log(force), full = as_log(full),
498498
wait_if_ongoing = as_log(wait_if_ongoing)))
499499
cc_POST(conn, url, args, ...)
500500
}
501501

502502
#' @export
503-
#' @rdname index
504-
index_clear_cache <- function(conn, index=NULL, filter=FALSE, filter_keys=NULL,
505-
fielddata=FALSE, query_cache=FALSE,
503+
#' @rdname indices
504+
index_clear_cache <- function(conn, index=NULL, filter=FALSE, filter_keys=NULL,
505+
fielddata=FALSE, query_cache=FALSE,
506506
id_cache=FALSE, ...) {
507507

508508
is_conn(conn)
@@ -512,9 +512,9 @@ index_clear_cache <- function(conn, index=NULL, filter=FALSE, filter_keys=NULL,
512512
} else {
513513
url <- sprintf("%s/_cache/clear", url)
514514
}
515-
args <- ec(list(filter = as_log(filter), filter_keys = filter_keys,
516-
fielddata = as_log(fielddata),
517-
query_cache = as_log(query_cache),
515+
args <- ec(list(filter = as_log(filter), filter_keys = filter_keys,
516+
fielddata = as_log(fielddata),
517+
query_cache = as_log(query_cache),
518518
id_cache = as_log(id_cache)))
519519
cc_POST(conn, url, args, ...)
520520
}
@@ -533,7 +533,7 @@ close_open <- function(conn, index, which, ...) {
533533
es_GET_wrap1 <- function(conn, index, which, args=NULL, ...) {
534534
url <- conn$make_url()
535535
url <- if (is.null(index)) {
536-
file.path(url, which)
536+
file.path(url, which)
537537
} else {
538538
file.path(url, esc(cl(index)), which)
539539
}
@@ -543,7 +543,7 @@ es_GET_wrap1 <- function(conn, index, which, args=NULL, ...) {
543543
es_POST_ <- function(conn, index, which, args=NULL, ...) {
544544
url <- conn$make_url()
545545
url <- if (is.null(index)) {
546-
file.path(url, which)
546+
file.path(url, which)
547547
} else {
548548
file.path(url, esc(cl(index)), which)
549549
}

man/index.Rd renamed to man/indices.Rd

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)