writer

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: BSD-3-Clause Imports: 28 Imported by: 0

README

go-whosonfirst-elasticsearch/writer

Implement the whosonfirst/go-writer interfaces for writing Who's On First documents to an Elasticsearch index.

Documentation

Documentation is incomplete at this. Consult godoc in writer_es7.go for the time being.

See also

Documentation

Overview

Package writer implements the `whosonfirst/go-writer/v2` interfaces for writing documents to Elasticsearch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewElasticsearchV2Writer

func NewElasticsearchV2Writer(ctx context.Context, uri string) (wof_writer.Writer, error)

func NewElasticsearchV7Writer

func NewElasticsearchV7Writer(ctx context.Context, uri string) (wof_writer.Writer, error)

NewElasticsearchV7Writer returns a new `ElasticsearchV7Writer` instance for writing documents to an Elasticsearch index using the github.com/elastic/go-elasticsearch/v7 package configured by 'uri' which is expected to take the form of:

elasticsearch://{HOST}:{PORT}/{INDEX}?{QUERY_PARAMETERS}
elasticsearch7://{HOST}:{PORT}/{INDEX}?{QUERY_PARAMETERS}

Where {QUERY_PARAMETERS} may be one or more of the following: * ?debug={BOOLEAN}. If true then verbose Elasticsearch logging for requests and responses will be enabled. Default is false. * ?bulk-index={BOOLEAN}. If true then writes will be performed using a "bulk indexer". Default is true. * ?workers={INT}. The number of users to enable for bulk indexing. Default is 10.

func NewElasticsearchV8Writer added in v0.10.0

func NewElasticsearchV8Writer(ctx context.Context, uri string) (wof_writer.Writer, error)

NewElasticsearchV8Writer returns a new `ElasticsearchV8Writer` instance for writing documents to an Elasticsearch index using the github.com/elastic/go-elasticsearch/v8 package configured by 'uri' which is expected to take the form of:

elasticsearch://{USER}:{PASSWORD}@{HOST}:{PORT}/{INDEX}?{QUERY_PARAMETERS}
elasticsearch7://{USER}:{PASSWORD}@{HOST}:{PORT}/{INDEX}?{QUERY_PARAMETERS}

Where {QUERY_PARAMETERS} may be one or more of the following: * ?ca-cert-uri={STRING}. A valid gocloud.dev/runtimevar URI which, when dereferenced, will contain the Elasticsearch CA certificate to use for HTTPS requests. * ?es-password-uri={STRING}. An optional gocloud.dev/runtimevar URI which, when dereferenced, will contain the password for the {USER} account when making requests. If present, this value supersedes any password set in the "{USER}:{PATH}" component of 'uri'. * ?debug={BOOLEAN}. If true then verbose Elasticsearch logging for requests and responses will be enabled. Default is false. * ?bulk-index={BOOLEAN}. If true then writes will be performed using a "bulk indexer". Default is true. * ?workers={INT}. The number of users to enable for bulk indexing. Default is 10.

Types

type ElasticsearchV2Writer

type ElasticsearchV2Writer struct {
	wof_writer.Writer
	// contains filtered or unexported fields
}

func (*ElasticsearchV2Writer) Close

func (wr *ElasticsearchV2Writer) Close(ctx context.Context) error

func (*ElasticsearchV2Writer) Flush

func (wr *ElasticsearchV2Writer) Flush(ctx context.Context) error

func (*ElasticsearchV2Writer) SetLogger added in v0.9.3

func (wr *ElasticsearchV2Writer) SetLogger(ctx context.Context, logger *log.Logger) error

func (*ElasticsearchV2Writer) Write

func (wr *ElasticsearchV2Writer) Write(ctx context.Context, path string, r io.ReadSeeker) (int64, error)

func (*ElasticsearchV2Writer) WriterURI

func (wr *ElasticsearchV2Writer) WriterURI(ctx context.Context, uri string) string

type ElasticsearchV7Writer

type ElasticsearchV7Writer struct {
	wof_writer.Writer
	// contains filtered or unexported fields
}

ElasticsearchV7Writer is a struct that implements the `Writer` interface for writing documents to an Elasticsearch index using the github.com/elastic/go-elasticsearch/v7 package.

func (*ElasticsearchV7Writer) Close

func (wr *ElasticsearchV7Writer) Close(ctx context.Context) error

Close waits for all pending writes to complete and closes the underlying writer mechanism.

func (*ElasticsearchV7Writer) Flush

func (wr *ElasticsearchV7Writer) Flush(ctx context.Context) error

Flush() does nothing in a `ElasticsearchV7Writer` context.

func (*ElasticsearchV7Writer) SetLogger added in v0.9.3

func (wr *ElasticsearchV7Writer) SetLogger(ctx context.Context, logger *log.Logger) error

SetLogger assigns 'logger' to 'wr'.

func (*ElasticsearchV7Writer) Write

func (wr *ElasticsearchV7Writer) Write(ctx context.Context, path string, r io.ReadSeeker) (int64, error)

Write copies the content of 'fh' to the Elasticsearch index defined in `NewElasticsearchV7Writer`.

func (*ElasticsearchV7Writer) WriterURI

func (wr *ElasticsearchV7Writer) WriterURI(ctx context.Context, uri string) string

WriterURI returns 'uri' unchanged

type ElasticsearchV8Writer added in v0.10.0

type ElasticsearchV8Writer struct {
	wof_writer.Writer
	// contains filtered or unexported fields
}

ElasticsearchV8Writer is a struct that implements the `Writer` interface for writing documents to an Elasticsearch index using the github.com/elastic/go-elasticsearch/v8 package.

func (*ElasticsearchV8Writer) Close added in v0.10.0

func (wr *ElasticsearchV8Writer) Close(ctx context.Context) error

Close waits for all pending writes to complete and closes the underlying writer mechanism.

func (*ElasticsearchV8Writer) Flush added in v0.10.0

func (wr *ElasticsearchV8Writer) Flush(ctx context.Context) error

Flush() does nothing in a `ElasticsearchV8Writer` context.

func (*ElasticsearchV8Writer) SetLogger added in v0.10.0

func (wr *ElasticsearchV8Writer) SetLogger(ctx context.Context, logger *log.Logger) error

SetLogger assigns 'logger' to 'wr'.

func (*ElasticsearchV8Writer) Write added in v0.10.0

func (wr *ElasticsearchV8Writer) Write(ctx context.Context, path string, r io.ReadSeeker) (int64, error)

Write copies the content of 'fh' to the Elasticsearch index defined in `NewElasticsearchV8Writer`.

func (*ElasticsearchV8Writer) WriterURI added in v0.10.0

func (wr *ElasticsearchV8Writer) WriterURI(ctx context.Context, uri string) string

WriterURI returns 'uri' unchanged

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL