Description Usage Arguments Details Value See Also Examples
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.
1 | make_es_settings(analyzers = c(), mappings = c())
|
analyzers |
A vector of zero or more analyzers to include in settings |
mappings |
A vector of one or more document mappings to include |
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.
A JSON of elasticsearch settings
load_es_json
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.