make_es_settings: Make elastic settings object from JSONs

Description Usage Arguments Details Value See Also Examples

View source: R/es_settings.R

Description

Better indexing and search with elastic requires customizing the settings (e.g., analyzers) and document mappings. Both components are sent to elastic in JSON, and we store the individual JSON entries in separate files in inst/extdata. For example, esadocs_analyzer.json is a single object for the app's elastic analyzer, and each document type (Fed. Reg. docs, recovery plans, etc.) has its own JSON file.

Usage

1
make_es_settings(analyzers = c(), mappings = c())

Arguments

analyzers

A vector of zero or more analyzers to include in settings

mappings

A vector of one or more document mappings to include

Details

While I would like to just use one JSON parser across the entire esadocs package, there's a hiccup. jsonlite is actively maintained and has a public GitHub repo, but it handles terminal JSON values in a way that elastic doesn't like (converts all values to an array). In contrast, RJSONIO, which doesn't appear to be actively maintained, handles terminal values 'correctly' for elastic. So we have to use it here.

Value

A JSON of elasticsearch settings

See Also

load_es_json

Examples

1
2
3
4
5
analyzer <- load_es_json("data-raw/esadocs_analyzer.json")
fedreg <- load_es_json("data-raw/federal_register_mapping.json")
recplan <- load_es_json("data-raw/recovery_plan_mapping")
make_es_settings(analyzers = c(analyzer),
                 mappings = c(fedreg, recplan)

jacob-ogre/esadocs documentation built on May 18, 2019, 8 a.m.