porter

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: MIT Imports: 10 Imported by: 0

README

🚢 Porter

Porter is a flexible and composable migration toolkit for Elasticsearch, written in Go. It helps developers define, manage, and test index definitions and synthetic document generation.

  • 📦 Define Elasticsearch index settings and mappings with a fluent DSL
  • 📁 Support for reading documents from files or generating in-memory

⚙️ Usage

This section outlines the typical flow for using Porter in your application: install the package, set up the Elasticsearch client, create a migration instance, define a configuration, and run the migration.

1. Get Package

Install Porter using go get.

go get github.com/xoticdsign/porter
2. Configure Elasticsearch

Establish a connection to your Elasticsearch instance using the official Go client.

cc, err := elasticsearch.NewDefaultClient()
if err != nil {
   panic(err)
}
3. Create new Porter instance

Initialize a new Porter migrator with the Elasticsearch client.

p := porter.New(cc)
4. Create and define Porter config

Define your index name, settings, and field mappings using Porter’s fluent config API.

c := porter.Config{
   Name: ...
   Definition: ...
}
5. Migrate

Run .MigrateUp() to create an index and insert fake documents or load them from your own file, and .MigrateDown() to remove partially or completely.

// Migrate Up
err := migrator.MigrateUp(
   config,
   migrator.Index.MigrateIndex(),
   migrator.Documents.MigrateDocuments(migrator.Documents.Origin.Generate(100)),
)
if err != nil {
   panic(err)
}

// Migrate Down
err := migrator.MigrateDown(
      config,
      migrator.Documents.MigrateDocuments(nil),
      migrator.Index.MigrateIndex(),
   )
if err != nil {
   panic(err)
}

📘 Examples

These examples demonstrate real-world usage of Porter for creating and deleting Elasticsearch indices and documents.

Migrating Up

This example demonstrates how to create a new index and insert 100 fake documents. It defines a basic Config object with field mappings. Then it applies .MigrateUp(), which:

  • Creates the index using the provided settings/mappings
  • Inserts 100 generated documents using the configured field types
package main

import (
   "github.com/elastic/go-elasticsearch/v8"
   "github.com/xoticdsign/porter"
)

func main() {
   cc, _ := es.NewDefaultClient()

   p := porter.New(cc)

   c := porter.Config{
      Name: "index",
      Definition: porter.DefinitionConfig{
         Mappings: &porter.MappingsConfig{
            Properties: migrator.Index.Mappings.NewFields(
               migrator.Index.Mappings.Properties.Keyword("keyword", porter.FakeCity),
               migrator.Index.Mappings.Properties.Integer("integer", porter.FakeIntegerInt),
            ),
         },
      },
   }

   err := migrator.MigrateUp(
      config,
      migrator.Index.MigrateIndex(),
      migrator.Documents.MigrateDocuments(migrator.Documents.Origin.Generate(100)),
   )
   if err != nil {
      panic(err)
   }
}
Migrating Down

This example demonstrates how to delete documents and the index. .MigrateDown() will:

  • Delete all documents using a match_all query
  • Drop the index itself
package main

import (
   "github.com/elastic/go-elasticsearch/v8"
   "github.com/xoticdsign/porter"
)

func main() {
   cc, _ := es.NewDefaultClient()

   p := porter.New(cc)

   c := porter.Config{
      Name: "index",
      Definition: porter.DefinitionConfig{
         Mappings: &porter.MappingsConfig{
            Properties: migrator.Index.Mappings.NewFields(
               migrator.Index.Mappings.Properties.Keyword("keyword", porter.FakeCity),
               migrator.Index.Mappings.Properties.Integer("integer", porter.FakeIntegerInt),
            ),
         },
      },
   }

   err := migrator.MigrateDown(
      config,
      migrator.Documents.MigrateDocuments(nil),
      migrator.Index.MigrateIndex(),
   )
   if err != nil {
      panic(err)
   }
}

🧠 Porter API Reference

This section describes the core building blocks of the Porter toolkit, including its primary functions, index/document operations, and configuration options.

Porter main functions

These are the top-level functions for initializing and running migrations.

Function Description
porter.New(< Elasticsearch client >) Initializes a new Porter migrator
.MigrateUp(< Porter config >, < Index operation >, < Documents operation >) Creates an index and inserts documents
.MigrateDown(< Porter config >, < Documents operation >, < Index operation >) Deletes documents and the index
Index operations

Functions related to creating or skipping index operations during migration.

Function Description
.MigrateIndex() Creates or deletes the index based on direction
.NoIndex() Skip index operations
Documents operations

Functions related to inserting or skipping document operations during migration.

Function Description
.MigrateDocuments(< Origin operation >) Adds or deletes documents
.NoDocuments() Skip document operations
Origin operations

Origin operations define where the documents should come from.

Function Description
.Generate(< Amount of documents to generate >) Dynamically generates documents using configured field fakes.
.FromFile(< Path to File to with migrations >) Loads raw JSON-formatted documents from a file.

🛠 Configuring Porter

Porter configuration is done using the porter.Config struct:

  • Name: Name of the Elasticsearch index
  • Definition.Settings: Defines shards, replicas, analyzers, and normalizers
  • Definition.Mappings: Defines field properties like type, storage, analyzers, etc.
Defining Field Types

Field types are created using fluent builder functions under p.Index.Mappings.Properties. Each type has optional configuration methods to customize it's behavior.

Properties: p.Index.Mappings.NewFields(
   p.Index.Mappings.Properties.Keyword("keyword", porter.FakeCity,
      p.Index.Mappings.Properties.Keyword.WithStore(ture),
      p.Index.Mappings.Properties.Keyword.WithNormalizer("normalizer"),
   ),
   p.Index.Mappings.Properties.Integer("integer", porter.FakeIntegerInt,
      p.Index.Mappings.Properties.Integer.WithStore(true),
      p.Index.Mappings.Properties.Integer.WithNullValue(0),
   ),
),

The value generators (like porter.FakeCity, porter.FakeIntegerInt) are used when generating documents dynamically with .Origin.Generate(...).

Supported Field Types

You can use the following field types with corresponding builder functions:

  • Keyword
  • Text
  • Integer
  • Long
  • Short
  • Byte
  • Float
  • Double
  • HalfFloat
  • ScaledFloat
  • Date
  • Boolean
  • IP

Each type has dedicated .With*() helpers (e.g. .WithIndex(...), .WithStore(...), .WithCoerce(...), .WithNullValue(...), etc.).

Defining Analyzers

Analyzers are configured inside Settings.Analysis.Analyzer using built-in or custom types. Here's how to define a simple custom analyzer:

Analysis: &porter.AnalysisConfig{
   Analyzer: p.Index.Settings.Analysis.NewAnalyzer(
      p.Index.Settings.Analysis.Analyzer.Custom("analyzer",
         p.Index.Settings.Analysis.Analyzer.Custom.WithTokenizer("tokenizer"),
         p.Index.Settings.Analysis.Analyzer.Custom.WithFilter([]porter.AnalyzerCustomFilter{
            porter.AnalyzerCustomFilterLowercase,
            porter.AnalyzerCustomFilterStop,
         }),
      ),
   ),
},

You can also use built-in analyzers like:

p.Index.Settings.Analysis.NewAnalyzer(
   p.Index.Settings.Analysis.Analyzer.Simple("analyzer"),
)
Defining Normalizers

Normalizers work similarly to analyzers but are applied to keyword fields. You define them using Settings.Analysis.Normalizer:

Normalizer: p.Index.Settings.Analysis.NewNormalizer(
   p.Index.Settings.Analysis.Normalizer.Custom("normalizer",
      p.Index.Settings.Analysis.Normalizer.Custom.WithFilter([]porter.NormalizerCustomFilter{
         porter.NormalizerCustomFilterASCIIFolding,
         porter.NormalizerCustomFilterLowercase,
      }),
   ),
),

This normalizer can now be referenced by any keyword field via .WithNormalizer(< Normalizer name >).

🤝 Contribution

Contributions are welcome! If you’d like to improve the toolkit, fix bugs, or add features:

  • Fork this repository
  • Create your feature branch: git checkout -b feature/my-feature
  • Commit your changes: git commit -am "Add my feature"
  • Push to the branch: git push origin feature/my-feature
  • Open a pull request
  • Please ensure your code is clean, covered by tests, and adheres to idiomatic Go practices.

If you have ideas, feedback, or questions—feel free to open an issue or start a discussion.

📄 License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientBadConnection     = fmt.Errorf("elasticsearch client: failed to establish a connection")
	ErrClientCreatingIndex     = fmt.Errorf("elasticsearch client: failed to create index")
	ErrClientCreatingDocuments = fmt.Errorf("elasticsearch client: bulk insert operation failed")
	ErrClientDeletingIndex     = fmt.Errorf("elasticsearch client: failed to delete index")
	ErrClientDeletingDocuments = fmt.Errorf("elasticsearch client: failed to delete documents by query")

	ErrMigratorMigratingIndex = fmt.Errorf("migrator: index operation failed during migration process")
	ErrMigratorDocuments      = fmt.Errorf("migrator: document operation failed during migration process")

	ErrPorterMigratingUp   = fmt.Errorf("porter: failed to perform 'up' migration")
	ErrPorterMigratingDown = fmt.Errorf("porter: failed to perform 'down' migration")
)
View Source
var (
	ErrOriginFromFile = fmt.Errorf("origin: failed to read documents from file")
)

Functions

This section is empty.

Types

type AnalysisConfig

type AnalysisConfig struct {
	Analyzer   map[string]interface{} `json:"analyzer,omitempty"`
	Normalizer map[string]interface{} `json:"normalizer,omitempty"`
}

AnalysisConfig{} holds custom analysis settings for the Elasticsearch index, including analyzers and normalizers to control text processing during indexing and searching.

type AnalyzerCustom

type AnalyzerCustom func(name string, properties ...AnalyzerCustomProperties) AnalyzerFunc

func (AnalyzerCustom) WithCharFilter

WithCharFilter() adds one or more character filters to a custom analyzer.

func (AnalyzerCustom) WithFilter

WithFilter() sets the list of token filters to apply to the output of the tokenizer.

func (AnalyzerCustom) WithPositionIncrementGap

func (c AnalyzerCustom) WithPositionIncrementGap(value int) AnalyzerCustomProperties

WithPositionIncrementGap() sets the position increment gap.

func (AnalyzerCustom) WithTokenizer

WithTokenizer() sets the tokenizer for a custom analyzer.

type AnalyzerCustomCharFilter

type AnalyzerCustomCharFilter string

AnalyzerCustomCharFilter defines character filters that modify text before tokenization.

var (
	AnalyzerCustomCharFilterHTMLStrip      AnalyzerCustomCharFilter = "html_strip"
	AnalyzerCustomCharFilterMapping        AnalyzerCustomCharFilter = "mapping"
	AnalyzerCustomCharFilterPatternReplace AnalyzerCustomCharFilter = "pattern_replace"
)

type AnalyzerCustomFilter

type AnalyzerCustomFilter string

AnalyzerCustomFilter defines token filters that modify or enhance token streams after tokenization.

var (
	AnalyzerCustomFilterApostrophe            AnalyzerCustomFilter = "apostrophe"
	AnalyzerCustomFilterASCIIFolding          AnalyzerCustomFilter = "asciifolding"
	AnalyzerCustomFilterCJKBigram             AnalyzerCustomFilter = "cjk_bigram"
	AnalyzerCustomFilterCJKWidth              AnalyzerCustomFilter = "cjk_width"
	AnalyzerCustomFilterClassic               AnalyzerCustomFilter = "classic"
	AnalyzerCustomFilterCommonGrams           AnalyzerCustomFilter = "common_grams"
	AnalyzerCustomFilterConditional           AnalyzerCustomFilter = "condition"
	AnalyzerCustomFilterDecimalDigit          AnalyzerCustomFilter = "decimal_digit"
	AnalyzerCustomFilterDelimitedPayload      AnalyzerCustomFilter = "delimited_payload"
	AnalyzerCustomFilterDictionaryDecompound  AnalyzerCustomFilter = "dictionary_decompounder"
	AnalyzerCustomFilterEdgeNGram             AnalyzerCustomFilter = "edge_ngram"
	AnalyzerCustomFilterElision               AnalyzerCustomFilter = "elision"
	AnalyzerCustomFilterFingerprint           AnalyzerCustomFilter = "fingerprint"
	AnalyzerCustomFilterFlattenGraph          AnalyzerCustomFilter = "flatten_graph"
	AnalyzerCustomFilterHunspell              AnalyzerCustomFilter = "hunspell"
	AnalyzerCustomFilterHyphenationDecompound AnalyzerCustomFilter = "hyphenation_decompounder"
	AnalyzerCustomFilterKeepTypes             AnalyzerCustomFilter = "keep_types"
	AnalyzerCustomFilterKeepWords             AnalyzerCustomFilter = "keep_words"
	AnalyzerCustomFilterKeywordMarker         AnalyzerCustomFilter = "keyword_marker"
	AnalyzerCustomFilterKeywordRepeat         AnalyzerCustomFilter = "keyword_repeat"
	AnalyzerCustomFilterKStem                 AnalyzerCustomFilter = "kstem"
	AnalyzerCustomFilterLength                AnalyzerCustomFilter = "length"
	AnalyzerCustomFilterLimitTokenCount       AnalyzerCustomFilter = "limit"
	AnalyzerCustomFilterLowercase             AnalyzerCustomFilter = "lowercase"
	AnalyzerCustomFilterMinHash               AnalyzerCustomFilter = "min_hash"
	AnalyzerCustomFilterMultiplexer           AnalyzerCustomFilter = "multiplexer"
	AnalyzerCustomFilterNGram                 AnalyzerCustomFilter = "ngram"
	AnalyzerCustomFilterNormalization         AnalyzerCustomFilter = "normalization"
	AnalyzerCustomFilterPatternCapture        AnalyzerCustomFilter = "pattern_capture"
	AnalyzerCustomFilterPatternReplace        AnalyzerCustomFilter = "pattern_replace"
	AnalyzerCustomFilterPhonetic              AnalyzerCustomFilter = "phonetic"
	AnalyzerCustomFilterPorterStem            AnalyzerCustomFilter = "porter_stem"
	AnalyzerCustomFilterPredicateScript       AnalyzerCustomFilter = "predicate_script"
	AnalyzerCustomFilterRemoveDuplicates      AnalyzerCustomFilter = "remove_duplicates"
	AnalyzerCustomFilterReverse               AnalyzerCustomFilter = "reverse"
	AnalyzerCustomFilterShingle               AnalyzerCustomFilter = "shingle"
	AnalyzerCustomFilterSnowball              AnalyzerCustomFilter = "snowball"
	AnalyzerCustomFilterStemmer               AnalyzerCustomFilter = "stemmer"
	AnalyzerCustomFilterStemmerOverride       AnalyzerCustomFilter = "stemmer_override"
	AnalyzerCustomFilterStop                  AnalyzerCustomFilter = "stop"
	AnalyzerCustomFilterSynonym               AnalyzerCustomFilter = "synonym"
	AnalyzerCustomFilterSynonymGraph          AnalyzerCustomFilter = "synonym_graph"
	AnalyzerCustomFilterTrim                  AnalyzerCustomFilter = "trim"
	AnalyzerCustomFilterTruncate              AnalyzerCustomFilter = "truncate"
	AnalyzerCustomFilterUnique                AnalyzerCustomFilter = "unique"
	AnalyzerCustomFilterUppercase             AnalyzerCustomFilter = "uppercase"
	AnalyzerCustomFilterWordDelimiter         AnalyzerCustomFilter = "word_delimiter"
	AnalyzerCustomFilterWordDelimiterGraph    AnalyzerCustomFilter = "word_delimiter_graph"
)

type AnalyzerCustomProperties

type AnalyzerCustomProperties func() map[string]interface{}

type AnalyzerCustomTokenizer

type AnalyzerCustomTokenizer string

AnalyzerCustomTokenizer defines available tokenizer types for custom analyzers.

var (
	AnalyzerCustomTokenizerStandard           AnalyzerCustomTokenizer = "standard"
	AnalyzerCustomTokenizerLetter             AnalyzerCustomTokenizer = "letter"
	AnalyzerCustomTokenizerLowercase          AnalyzerCustomTokenizer = "lowercase"
	AnalyzerCustomTokenizerWhitespace         AnalyzerCustomTokenizer = "whitespace"
	AnalyzerCustomTokenizerUAXURLEmail        AnalyzerCustomTokenizer = "uax_url_email"
	AnalyzerCustomTokenizerClassic            AnalyzerCustomTokenizer = "classic"
	AnalyzerCustomTokenizerThai               AnalyzerCustomTokenizer = "thai"
	AnalyzerCustomTokenizerNGram              AnalyzerCustomTokenizer = "ngram"
	AnalyzerCustomTokenizerEdgeNGram          AnalyzerCustomTokenizer = "edge_ngram"
	AnalyzerCustomTokenizerKeyword            AnalyzerCustomTokenizer = "keyword"
	AnalyzerCustomTokenizerPattern            AnalyzerCustomTokenizer = "pattern"
	AnalyzerCustomTokenizerSimplePattern      AnalyzerCustomTokenizer = "simple_pattern"
	AnalyzerCustomTokenizerCharGroup          AnalyzerCustomTokenizer = "char_group"
	AnalyzerCustomTokenizerSimplePatternSplit AnalyzerCustomTokenizer = "simple_pattern_split"
	AnalyzerCustomTokenizerPathHierarchy      AnalyzerCustomTokenizer = "path_hierarchy"
)

type AnalyzerFingerprint

type AnalyzerFingerprint func(name string, properties ...AnalyzerFingerprintProperties) AnalyzerFunc

func (AnalyzerFingerprint) WithMaxOutputSize

func (f AnalyzerFingerprint) WithMaxOutputSize(value int) AnalyzerFingerprintProperties

WithMaxOutputSize() sets max length of the resulting fingerprint string.

func (AnalyzerFingerprint) WithSeparator

WithSeparator() sets the string used to join tokens into a fingerprint.

func (AnalyzerFingerprint) WithStopwords

func (f AnalyzerFingerprint) WithStopwords(value []string) AnalyzerFingerprintProperties

WithStopwords() sets the stopwords for the standard analyzer.

func (AnalyzerFingerprint) WithStopwordsPath

func (f AnalyzerFingerprint) WithStopwordsPath(value string) AnalyzerFingerprintProperties

WithStopwordsPath() sets an external stopwords file path.

type AnalyzerFingerprintProperties

type AnalyzerFingerprintProperties func() map[string]interface{}

type AnalyzerFunc

type AnalyzerFunc func() map[string]interface{}

type AnalyzerKeyword

type AnalyzerKeyword func(name string) AnalyzerFunc

type AnalyzerLanguage

type AnalyzerLanguage func(name string, language AnalyzerLanguageLanguage, properties ...AnalyzerLanguageProperties) AnalyzerFunc

func (AnalyzerLanguage) WithStemExclusion

func (l AnalyzerLanguage) WithStemExclusion(value []string) AnalyzerLanguageProperties

WithStemExclusion() defines a list of terms that should not be stemmed during analysis.

func (AnalyzerLanguage) WithStopwords

func (l AnalyzerLanguage) WithStopwords(value []string) AnalyzerLanguageProperties

WithStopwords() sets the stopwords for the standard analyzer.

func (AnalyzerLanguage) WithStopwordsPath

func (l AnalyzerLanguage) WithStopwordsPath(value string) AnalyzerLanguageProperties

WithStopwordsPath() sets an external stopwords file path.

type AnalyzerLanguageLanguage

type AnalyzerLanguageLanguage string

AnalyzerLanguageLanguage defines language-specific analyzers provided by Elasticsearch.

var (
	AnalyzerLanguageArabic     AnalyzerLanguageLanguage = "arabic"
	AnalyzerLanguageArmenian   AnalyzerLanguageLanguage = "armenian"
	AnalyzerLanguageBasque     AnalyzerLanguageLanguage = "basque"
	AnalyzerLanguageBengali    AnalyzerLanguageLanguage = "bengali"
	AnalyzerLanguageBrazilian  AnalyzerLanguageLanguage = "brazilian"
	AnalyzerLanguageBulgarian  AnalyzerLanguageLanguage = "bulgarian"
	AnalyzerLanguageCatalan    AnalyzerLanguageLanguage = "catalan"
	AnalyzerLanguageCJK        AnalyzerLanguageLanguage = "cjk"
	AnalyzerLanguageCzech      AnalyzerLanguageLanguage = "czech"
	AnalyzerLanguageDanish     AnalyzerLanguageLanguage = "danish"
	AnalyzerLanguageDutch      AnalyzerLanguageLanguage = "dutch"
	AnalyzerLanguageEnglish    AnalyzerLanguageLanguage = "english"
	AnalyzerLanguageEstonian   AnalyzerLanguageLanguage = "estonian"
	AnalyzerLanguageFinnish    AnalyzerLanguageLanguage = "finnish"
	AnalyzerLanguageFrench     AnalyzerLanguageLanguage = "french"
	AnalyzerLanguageGalician   AnalyzerLanguageLanguage = "galician"
	AnalyzerLanguageGerman     AnalyzerLanguageLanguage = "german"
	AnalyzerLanguageGreek      AnalyzerLanguageLanguage = "greek"
	AnalyzerLanguageHindi      AnalyzerLanguageLanguage = "hindi"
	AnalyzerLanguageHungarian  AnalyzerLanguageLanguage = "hungarian"
	AnalyzerLanguageIndonesian AnalyzerLanguageLanguage = "indonesian"
	AnalyzerLanguageIrish      AnalyzerLanguageLanguage = "irish"
	AnalyzerLanguageItalian    AnalyzerLanguageLanguage = "italian"
	AnalyzerLanguageLatvian    AnalyzerLanguageLanguage = "latvian"
	AnalyzerLanguageLithuanian AnalyzerLanguageLanguage = "lithuanian"
	AnalyzerLanguageNorwegian  AnalyzerLanguageLanguage = "norwegian"
	AnalyzerLanguagePersian    AnalyzerLanguageLanguage = "persian"
	AnalyzerLanguagePortuguese AnalyzerLanguageLanguage = "portuguese"
	AnalyzerLanguageRomanian   AnalyzerLanguageLanguage = "romanian"
	AnalyzerLanguageRussian    AnalyzerLanguageLanguage = "russian"
	AnalyzerLanguageSerbian    AnalyzerLanguageLanguage = "serbian"
	AnalyzerLanguageSorani     AnalyzerLanguageLanguage = "sorani"
	AnalyzerLanguageSpanish    AnalyzerLanguageLanguage = "spanish"
	AnalyzerLanguageSwedish    AnalyzerLanguageLanguage = "swedish"
	AnalyzerLanguageTurkish    AnalyzerLanguageLanguage = "turkish"
	AnalyzerLanguageThai       AnalyzerLanguageLanguage = "thai"
)

type AnalyzerLanguageProperties

type AnalyzerLanguageProperties func() map[string]interface{}

type AnalyzerPattern

type AnalyzerPattern func(name string, properties ...AnalyzerPatternProperties) AnalyzerFunc

func (AnalyzerPattern) WithFlags

WithFlags() configures regex flags (e.g., CASE_INSENSITIVE).

func (AnalyzerPattern) WithLowercase

func (p AnalyzerPattern) WithLowercase(enable bool) AnalyzerPatternProperties

WithLowercase() sets whether text should be lowercased.

func (AnalyzerPattern) WithPattern

WithPattern() sets the pattern used to tokenize text.

func (AnalyzerPattern) WithStopwords

func (p AnalyzerPattern) WithStopwords(value []string) AnalyzerPatternProperties

WithStopwords() sets the stopwords for the standard analyzer.

func (AnalyzerPattern) WithStopwordsPath

func (p AnalyzerPattern) WithStopwordsPath(value string) AnalyzerPatternProperties

WithStopwordsPath() sets an external stopwords file path.

type AnalyzerPatternFlags

type AnalyzerPatternFlags string

AnalyzerPatternFlags represents Java-compatible regex flags for pattern tokenizers.

var (
	AnalyzerPatternFlagsCaseInsensitive AnalyzerPatternFlags = "CASE_INSENSITIVE"
	AnalyzerPatternFlagsComments        AnalyzerPatternFlags = "COMMENTS"
	AnalyzerPatternFlagsDotAll          AnalyzerPatternFlags = "DOTALL"
	AnalyzerPatternFlagsMultiline       AnalyzerPatternFlags = "MULTILINE"
	AnalyzerPatternFlagsUnicodeCase     AnalyzerPatternFlags = "UNICODE_CASE"
	AnalyzerPatternFlagsUnixLines       AnalyzerPatternFlags = "UNIX_LINES"
)

type AnalyzerPatternPattern

type AnalyzerPatternPattern string

AnalyzerPatternPattern defines common regex patterns used in pattern-based tokenizers.

var (
	AnalyzerPatternPatternNonWord     AnalyzerPatternPattern = `\W+`
	AnalyzerPatternPatternWhitespace  AnalyzerPatternPattern = `\s+`
	AnalyzerPatternPatternComma       AnalyzerPatternPattern = `,`
	AnalyzerPatternPatternPipe        AnalyzerPatternPattern = `\|`
	AnalyzerPatternPatternDot         AnalyzerPatternPattern = `\.`
	AnalyzerPatternPatternCustomWords AnalyzerPatternPattern = `[\s,;:\.\-]+`
)

type AnalyzerPatternProperties

type AnalyzerPatternProperties func() map[string]interface{}

type AnalyzerSimple

type AnalyzerSimple func(name string) AnalyzerFunc

type AnalyzerStandard

type AnalyzerStandard func(name string, properties ...AnalyzerStandardProperties) AnalyzerFunc

func (AnalyzerStandard) WithMaxTokenLength

func (s AnalyzerStandard) WithMaxTokenLength(value int) AnalyzerStandardProperties

WithMaxTokenLength() sets the max_token_length for the standard analyzer.

func (AnalyzerStandard) WithStopwords

func (s AnalyzerStandard) WithStopwords(value []string) AnalyzerStandardProperties

WithStopwords() sets the stopwords for the standard analyzer.

func (AnalyzerStandard) WithStopwordsPath

func (s AnalyzerStandard) WithStopwordsPath(value string) AnalyzerStandardProperties

WithStopwordsPath() sets an external stopwords file path.

type AnalyzerStandardProperties

type AnalyzerStandardProperties func() map[string]interface{}

type AnalyzerStop

type AnalyzerStop func(name string, properties ...AnalyzerStopProperties) AnalyzerFunc

func (AnalyzerStop) WithStopwords

func (s AnalyzerStop) WithStopwords(value []string) AnalyzerStopProperties

WithStopwords() sets the stopwords for the standard analyzer.

func (AnalyzerStop) WithStopwordsPath

func (s AnalyzerStop) WithStopwordsPath(value string) AnalyzerStopProperties

WithStopwordsPath() sets an external stopwords file path.

type AnalyzerStopProperties

type AnalyzerStopProperties func() map[string]interface{}

type AnalyzerWhitespace

type AnalyzerWhitespace func(name string) AnalyzerFunc

type Config

type Config struct {
	Name       string
	Definition DefinitionConfig
}

Config{} represents the overall configuration for an Elasticsearch index.

type DefinitionConfig

type DefinitionConfig struct {
	Settings *SettingsConfig `json:"settings,omitempty"`
	Mappings *MappingsConfig `json:"mappings,omitempty"`
}

DefinitionConfig{} contains the settings and mappings for an Elasticsearch index.

type Fake

type Fake string
var (
	FakeEmail     Fake = "email"
	FakeFirstName Fake = "first_name"
	FakeLastName  Fake = "last_name"
	FakeFullName  Fake = "full_name"
	FakeUsername  Fake = "username"
	FakePhone     Fake = "phone"
	FakeCountry   Fake = "country"
	FakeCity      Fake = "city"
	FakeStreet    Fake = "street"
	FakeZip       Fake = "zip"
	FakeUUID      Fake = "uuid"
	FakeURL       Fake = "url"
	FakeCompany   Fake = "company"
	FakeJobTitle  Fake = "job_title"
	FakeColor     Fake = "color"
	FakeIPv4      Fake = "ipv4"
	FakeIPv6      Fake = "ipv6"
	FakeBool      Fake = "bool"
	FakeInt       Fake = "int"
	FakeFloat     Fake = "float"
	FakeDate      Fake = "date"
	FakeTimestamp Fake = "timestamp"
	FakeParagraph Fake = "paragraph"
)

type FakeBoolean

type FakeBoolean string
var (
	FakeBooleanBool FakeBoolean = "bool"
)

type FakeByte

type FakeByte string
var (
	FakeByteInt FakeByte = "int"
)

type FakeDates

type FakeDates string
var (
	FakeDateDate      FakeDates = "date"
	FakeDateTimestamp FakeDates = "timestamp"
)

type FakeDouble

type FakeDouble string
var (
	FakeDoubleFloat FakeDouble = "float"
)

type FakeFloats

type FakeFloats string
var (
	FakeFloatFloat FakeFloats = "float"
)

type FakeHalfFloat

type FakeHalfFloat string
var (
	FakeHalfFloatFloat FakeHalfFloat = "float"
)

type FakeIP

type FakeIP string
var (
	FakeIPIPv4 FakeIP = "ipv4"
	FakeIPIPv6 FakeIP = "ipv6"
)

type FakeInteger

type FakeInteger string
var (
	FakeIntegerInt FakeInteger = "int"
)

type FakeLong

type FakeLong string
var (
	FakeLongInt FakeLong = "int"
)

type FakeScaledFloat

type FakeScaledFloat string
var (
	FakeScaledFloatFloat FakeScaledFloat = "float"
)

type FakeShort

type FakeShort string
var (
	FakeShortInt FakeShort = "int"
)

type FieldBoolean

type FieldBoolean func(name string, fake FakeBoolean, properties ...FieldBooleanProperties) FieldFunc

func (FieldBoolean) WithDocValues

func (b FieldBoolean) WithDocValues(enabled bool) FieldBooleanProperties

WithDocValues() adds a "doc_values" property to a boolean field.

func (FieldBoolean) WithIndex

func (b FieldBoolean) WithIndex(enabled bool) FieldBooleanProperties

WithIndex() adds an "index" property to a boolean field.

func (FieldBoolean) WithNullValue

func (b FieldBoolean) WithNullValue(value bool) FieldBooleanProperties

WithNullValue() adds a "null_value" property to a boolean field.

func (FieldBoolean) WithStore

func (b FieldBoolean) WithStore(enabled bool) FieldBooleanProperties

WithStore() adds a "store" property to a boolean field.

type FieldBooleanProperties

type FieldBooleanProperties func() map[string]interface{}

type FieldByte

type FieldByte func(name string, fake FakeByte, properties ...FieldByteProperties) FieldFunc

func (FieldByte) WithCoerce

func (b FieldByte) WithCoerce(enabled bool) FieldByteProperties

WithCoerce() adds a "coerce" property to a byte field.

func (FieldByte) WithDocValues

func (b FieldByte) WithDocValues(enabled bool) FieldByteProperties

WithDocValues() adds a "doc_values" property to a byte field.

func (FieldByte) WithIgnoreMalformed

func (b FieldByte) WithIgnoreMalformed(enabled bool) FieldByteProperties

WithIgnoreMalformed() adds an "ignore_malformed" property to a byte field.

func (FieldByte) WithIndex

func (b FieldByte) WithIndex(enabled bool) FieldByteProperties

WithIndex() adds an "index" property to a byte field.

func (FieldByte) WithNullValue

func (b FieldByte) WithNullValue(value int) FieldByteProperties

WithNullValue() adds a "null_value" property to a byte field.

func (FieldByte) WithStore

func (b FieldByte) WithStore(enabled bool) FieldByteProperties

WithStore() adds a "store" property to a byte field.

type FieldByteProperties

type FieldByteProperties func() map[string]interface{}

type FieldDate

type FieldDate func(name string, fake FakeDates, properties ...FieldDateProperties) FieldFunc

func (FieldDate) WithDocValues

func (d FieldDate) WithDocValues(enabled bool) FieldDateProperties

WithDocValues() adds a "doc_values" property to a date field.

func (FieldDate) WithFormat

func (d FieldDate) WithFormat(value string) FieldDateProperties

WithFormat() adds a "format" property to a date field.

func (FieldDate) WithIgnoreMalformed

func (d FieldDate) WithIgnoreMalformed(enabled bool) FieldDateProperties

WithIgnoreMalformed() adds an "ignore_malformed" property to a date field.

func (FieldDate) WithIndex

func (d FieldDate) WithIndex(enabled bool) FieldDateProperties

WithIndex() adds an "index" property to a date field.

func (FieldDate) WithStore

func (d FieldDate) WithStore(enabled bool) FieldDateProperties

WithStore() adds a "store" property to a date field.

type FieldDateProperties

type FieldDateProperties func() map[string]interface{}

type FieldDouble

type FieldDouble func(name string, fake FakeDouble, properties ...FieldDoubleProperties) FieldFunc

func (FieldDouble) WithCoerce

func (d FieldDouble) WithCoerce(enabled bool) FieldDoubleProperties

WithCoerce() adds a "coerce" property to a double field.

func (FieldDouble) WithDocValues

func (d FieldDouble) WithDocValues(enabled bool) FieldDoubleProperties

WithDocValues() adds a "doc_values" property to a double field.

func (FieldDouble) WithIgnoreMalformed

func (d FieldDouble) WithIgnoreMalformed(enabled bool) FieldDoubleProperties

WithIgnoreMalformed() adds an "ignore_malformed" property to a double field.

func (FieldDouble) WithIndex

func (d FieldDouble) WithIndex(enabled bool) FieldDoubleProperties

WithIndex() adds an "index" property to a double field.

func (FieldDouble) WithNullValue

func (d FieldDouble) WithNullValue(value int) FieldDoubleProperties

WithNullValue() adds a "null_value" property to a double field.

func (FieldDouble) WithStore

func (d FieldDouble) WithStore(enabled bool) FieldDoubleProperties

WithStore() adds a "store" property to a double field.

type FieldDoubleProperties

type FieldDoubleProperties func() map[string]interface{}

type FieldFloat

type FieldFloat func(name string, fake FakeFloats, properties ...FieldFloatProperties) FieldFunc

func (FieldFloat) WithCoerce

func (f FieldFloat) WithCoerce(enabled bool) FieldFloatProperties

WithCoerce() adds a "coerce" property to a float field.

func (FieldFloat) WithDocValues

func (f FieldFloat) WithDocValues(enabled bool) FieldFloatProperties

WithDocValues() adds a "doc_values" property to a float field.

func (FieldFloat) WithIgnoreMalformed

func (f FieldFloat) WithIgnoreMalformed(enabled bool) FieldFloatProperties

WithIgnoreMalformed() adds an "ignore_malformed" property to a float field.

func (FieldFloat) WithIndex

func (f FieldFloat) WithIndex(enabled bool) FieldFloatProperties

WithIndex() adds an "index" property to a float field.

func (FieldFloat) WithNullValue

func (f FieldFloat) WithNullValue(value int) FieldFloatProperties

WithNullValue() adds a "null_value" property to a float field.

func (FieldFloat) WithStore

func (f FieldFloat) WithStore(enabled bool) FieldFloatProperties

WithStore() adds a "store" property to a float field.

type FieldFloatProperties

type FieldFloatProperties func() map[string]interface{}

type FieldFunc

type FieldFunc func() map[string]interface{}

type FieldHalfFloat

type FieldHalfFloat func(name string, fake FakeHalfFloat, properties ...FieldHalfFloatProperties) FieldFunc

func (FieldHalfFloat) WithCoerce

func (h FieldHalfFloat) WithCoerce(enabled bool) FieldHalfFloatProperties

WithCoerce() adds a "coerce" property to a half_float field.

func (FieldHalfFloat) WithDocValues

func (h FieldHalfFloat) WithDocValues(enabled bool) FieldHalfFloatProperties

WithDocValues() adds a "doc_values" property to a half_float field.

func (FieldHalfFloat) WithIgnoreMalformed

func (h FieldHalfFloat) WithIgnoreMalformed(enabled bool) FieldHalfFloatProperties

WithIgnoreMalformed() adds an "ignore_malformed" property to a half_float field.

func (FieldHalfFloat) WithIndex

func (h FieldHalfFloat) WithIndex(enabled bool) FieldHalfFloatProperties

WithIndex() adds an "index" property to a half_float field.

func (FieldHalfFloat) WithNullValue

func (h FieldHalfFloat) WithNullValue(value int) FieldHalfFloatProperties

WithNullValue() adds a "null_value" property to a half_float field.

func (FieldHalfFloat) WithStore

func (h FieldHalfFloat) WithStore(enabled bool) FieldHalfFloatProperties

WithStore() adds a "store" property to a half_float field.

type FieldHalfFloatProperties

type FieldHalfFloatProperties func() map[string]interface{}

type FieldIP

type FieldIP func(name string, fake FakeIP, properties ...FieldIPProperties) FieldFunc

func (FieldIP) WithDocValues

func (i FieldIP) WithDocValues(enabled bool) FieldIPProperties

WithDocValues() adds a "doc_values" property to an IP field.

func (FieldIP) WithIndex

func (i FieldIP) WithIndex(enabled bool) FieldIPProperties

WithIndex() adds an "index" property to an IP field.

func (FieldIP) WithNullValue

func (i FieldIP) WithNullValue(value string) FieldIPProperties

WithNullValue() adds a "null_value" property to an IP field.

func (FieldIP) WithStore

func (i FieldIP) WithStore(enabled bool) FieldIPProperties

WithStore() adds a "store" property to an IP field.

type FieldIPProperties

type FieldIPProperties func() map[string]interface{}

type FieldInteger

type FieldInteger func(name string, fake FakeInteger, properties ...FieldIntegerProperties) FieldFunc

func (FieldInteger) WithCoerce

func (i FieldInteger) WithCoerce(enabled bool) FieldIntegerProperties

WithCoerce() adds a "coerce" property to an integer field.

func (FieldInteger) WithDocValues

func (i FieldInteger) WithDocValues(enabled bool) FieldIntegerProperties

WithDocValues() adds a "doc_values" property to an integer field.

func (FieldInteger) WithIgnoreMalformed

func (i FieldInteger) WithIgnoreMalformed(enabled bool) FieldIntegerProperties

WithIgnoreMalformed() adds an "ignore_malformed" property to an integer field.

func (FieldInteger) WithIndex

func (i FieldInteger) WithIndex(enabled bool) FieldIntegerProperties

WithIndex() adds an "index" property to an integer field.

func (FieldInteger) WithNullValue

func (i FieldInteger) WithNullValue(value int) FieldIntegerProperties

WithNullValue() adds a "null_value" property to an integer field.

func (FieldInteger) WithStore

func (i FieldInteger) WithStore(enabled bool) FieldIntegerProperties

WithStore() adds a "store" property to an integer field.

type FieldIntegerProperties

type FieldIntegerProperties func() map[string]interface{}

type FieldKeyword

type FieldKeyword func(name string, fake Fake, properties ...FieldKeywordProperties) FieldFunc

func (FieldKeyword) WithDocValues

func (k FieldKeyword) WithDocValues(enabled bool) FieldKeywordProperties

WithDocValues() adds a "doc_values" property to a FieldKeyword.

func (FieldKeyword) WithEagerGlobalOrdinals

func (k FieldKeyword) WithEagerGlobalOrdinals(enabled bool) FieldKeywordProperties

WithEagerGlobalOrdinals() adds an "eager_global_ordinals" property to a FieldKeyword.

func (FieldKeyword) WithIgnoreAbove

func (k FieldKeyword) WithIgnoreAbove(value int) FieldKeywordProperties

WithIgnoreAbove() adds an "ignore_above" property to a FieldKeyword.

func (FieldKeyword) WithIndex

func (k FieldKeyword) WithIndex(enabled bool) FieldKeywordProperties

WithIndex() adds an "index" property to a FieldKeyword.

func (FieldKeyword) WithNormalizer

func (k FieldKeyword) WithNormalizer(value string) FieldKeywordProperties

WithNormalizer() adds a "normalizer" property to a FieldKeyword.

func (FieldKeyword) WithNullValue

func (k FieldKeyword) WithNullValue(value string) FieldKeywordProperties

WithNullValue() adds a "null_value" property to a FieldKeyword.

func (FieldKeyword) WithStore

func (k FieldKeyword) WithStore(enabled bool) FieldKeywordProperties

WithStore() adds a "store" property to a FieldKeyword.

type FieldKeywordProperties

type FieldKeywordProperties func() map[string]interface{}

type FieldLong

type FieldLong func(name string, fake FakeLong, properties ...FieldLongProperties) FieldFunc

func (FieldLong) WithCoerce

func (l FieldLong) WithCoerce(enabled bool) FieldLongProperties

WithCoerce() adds a "coerce" property to a long field.

func (FieldLong) WithDocValues

func (l FieldLong) WithDocValues(enabled bool) FieldLongProperties

WithDocValues() adds a "doc_values" property to a long field.

func (FieldLong) WithIgnoreMalformed

func (l FieldLong) WithIgnoreMalformed(enabled bool) FieldLongProperties

WithIgnoreMalformed() adds an "ignore_malformed" property to a long field.

func (FieldLong) WithIndex

func (l FieldLong) WithIndex(enabled bool) FieldLongProperties

WithIndex() adds an "index" property to a long field.

func (FieldLong) WithNullValue

func (l FieldLong) WithNullValue(value int) FieldLongProperties

WithNullValue() adds a "null_value" property to a long field.

func (FieldLong) WithStore

func (l FieldLong) WithStore(enabled bool) FieldLongProperties

WithStore() adds a "store" property to a long field.

type FieldLongProperties

type FieldLongProperties func() map[string]interface{}

type FieldScaledFloat

type FieldScaledFloat func(name string, fake FakeScaledFloat, properties ...FieldScaledFloatProperties) FieldFunc

func (FieldScaledFloat) WithCoerce

func (s FieldScaledFloat) WithCoerce(enabled bool) FieldScaledFloatProperties

WithCoerce() adds a "coerce" property to a scaled_float field.

func (FieldScaledFloat) WithDocValues

func (s FieldScaledFloat) WithDocValues(enabled bool) FieldScaledFloatProperties

WithDocValues() adds a "doc_values" property to a scaled_float field.

func (FieldScaledFloat) WithIgnoreMalformed

func (s FieldScaledFloat) WithIgnoreMalformed(enabled bool) FieldScaledFloatProperties

WithIgnoreMalformed() adds an "ignore_malformed" property to a scaled_float field.

func (FieldScaledFloat) WithIndex

func (s FieldScaledFloat) WithIndex(enabled bool) FieldScaledFloatProperties

WithIndex() adds an "index" property to a scaled_float field.

func (FieldScaledFloat) WithNullValue

func (s FieldScaledFloat) WithNullValue(value int) FieldScaledFloatProperties

WithNullValue() adds a "null_value" property to a scaled_float field.

func (FieldScaledFloat) WithStore

func (s FieldScaledFloat) WithStore(enabled bool) FieldScaledFloatProperties

WithStore() adds a "store" property to a scaled_float field.

type FieldScaledFloatProperties

type FieldScaledFloatProperties func() map[string]interface{}

type FieldShort

type FieldShort func(name string, fake FakeShort, properties ...FieldShortProperties) FieldFunc

func (FieldShort) WithCoerce

func (s FieldShort) WithCoerce(enabled bool) FieldShortProperties

WithCoerce() adds a "coerce" property to a short field.

func (FieldShort) WithDocValues

func (s FieldShort) WithDocValues(enabled bool) FieldShortProperties

WithDocValues() adds a "doc_values" property to a short field.

func (FieldShort) WithIgnoreMalformed

func (s FieldShort) WithIgnoreMalformed(enabled bool) FieldShortProperties

WithIgnoreMalformed() adds an "ignore_malformed" property to a short field.

func (FieldShort) WithIndex

func (s FieldShort) WithIndex(enabled bool) FieldShortProperties

WithIndex() adds an "index" property to a short field.

func (FieldShort) WithNullValue

func (s FieldShort) WithNullValue(value int) FieldShortProperties

WithNullValue() adds a "null_value" property to a short field.

func (FieldShort) WithStore

func (s FieldShort) WithStore(enabled bool) FieldShortProperties

WithStore() adds a "store" property to a short field.

type FieldShortProperties

type FieldShortProperties func() map[string]interface{}

type FieldText

type FieldText func(name string, fake Fake, properties ...FieldTextProperties) FieldFunc

func (FieldText) WithAnalyzer

func (t FieldText) WithAnalyzer(value string) FieldTextProperties

WithAnalyzer() adds an "analyzer" property to a FieldText.

func (FieldText) WithEagerGlobalOrdinals

func (t FieldText) WithEagerGlobalOrdinals(enabled bool) FieldTextProperties

WithEagerGlobalOrdinals() adds an "eager_global_ordinals" property to a FieldText.

func (FieldText) WithIndex

func (t FieldText) WithIndex(enabled bool) FieldTextProperties

WithIndex() adds an "index" property to a FieldText.

func (FieldText) WithNorms

func (t FieldText) WithNorms(enabled bool) FieldTextProperties

WithNorms() adds a "norms" property to a FieldText.

func (FieldText) WithPositionIncrementGap

func (t FieldText) WithPositionIncrementGap(value int) FieldTextProperties

WithPositionIncrementGap() adds a "position_increment_gap" property to a FieldText.

func (FieldText) WithSearchAnalyzer

func (t FieldText) WithSearchAnalyzer(value string) FieldTextProperties

WithSearchAnalyzer() adds a "search_analyzer" property to a FieldText.

func (FieldText) WithStore

func (t FieldText) WithStore(enabled bool) FieldTextProperties

WithStore() adds a "store" property to a FieldText.

func (FieldText) WithTermVector

func (t FieldText) WithTermVector(value string) FieldTextProperties

WithTermVector() adds a "term_vector" property to a FieldText.

type FieldTextProperties

type FieldTextProperties func() map[string]interface{}

type IndexFunc

type IndexFunc func(t Temp) error

type LocationFromFile

type LocationFromFile func(path string) OriginFunc

type LocationGenerate

type LocationGenerate func(amount int) OriginFunc

type M

type M struct {
	Index     index
	Documents documents

	Client searcher
}

M{} represents the migration object that holds information about index and document migration.

func New

func New(cc *elasticsearch.Client) M

New() initializes and returns a new migration object.

func (M) MigrateDown

func (m M) MigrateDown(config Config, documents documentsFunc, index IndexFunc) error

MigrateDown() performs the "down" migration, which includes deleting documents and the index.

func (M) MigrateUp

func (m M) MigrateUp(config Config, index IndexFunc, documents documentsFunc) error

MigrateUp() performs the "up" migration, which includes creating/updating the index and migrating documents.

type MappingsConfig

type MappingsConfig struct {
	Properties map[string]interface{} `json:"properties,omitempty"`
}

MappingsConfig{} defines the field mappings for an Elasticsearch index, including the types and properties for each field in the index.

type NormalizerCustom

type NormalizerCustom func(name string, properties ...NormalizerCustomProperties) NormalizerFunc

func (NormalizerCustom) WithCharFilter

WithCharFilter() defines a list of character filters for the custom normalizer.

func (NormalizerCustom) WithFilter

WithFilter() defines a list of token filters to be used in the custom normalizer.

type NormalizerCustomCharFilter

type NormalizerCustomCharFilter string
var (
	NormalizerCustomCharFilterHTMLStrip      NormalizerCustomCharFilter = "html_strip"
	NormalizerCustomCharFilterMapping        NormalizerCustomCharFilter = "mapping"
	NormalizerCustomCharFilterPatternReplace NormalizerCustomCharFilter = "pattern_replace"
)

type NormalizerCustomFilter

type NormalizerCustomFilter string
var (
	NormalizerCustomFilterArabicNormalization  NormalizerCustomFilter = "arabic_normalization"
	NormalizerCustomFilterASCIIFolding         NormalizerCustomFilter = "asciifolding"
	NormalizerCustomFilterBengaliNormalization NormalizerCustomFilter = "bengali_normalization"
	NormalizerCustomFilterCJKWidth             NormalizerCustomFilter = "cjk_width"
	NormalizerCustomFilterDecimalDigit         NormalizerCustomFilter = "decimal_digit"
	NormalizerCustomFilterElision              NormalizerCustomFilter = "elision"
	NormalizerCustomFilterGermanNormalization  NormalizerCustomFilter = "german_normalization"
	NormalizerCustomFilterHindiNormalization   NormalizerCustomFilter = "hindi_normalization"
	NormalizerCustomFilterIndicNormalization   NormalizerCustomFilter = "indic_normalization"
	NormalizerCustomFilterLowercase            NormalizerCustomFilter = "lowercase"
	NormalizerCustomFilterPatternReplace       NormalizerCustomFilter = "pattern_replace"
	NormalizerCustomFilterPersianNormalization NormalizerCustomFilter = "persian_normalization"
	NormalizerCustomFilterScandinavianFolding  NormalizerCustomFilter = "scandinavian_folding"
	NormalizerCustomFilterSerbianNormalization NormalizerCustomFilter = "serbian_normalization"
	NormalizerCustomFilterSoraniNormalization  NormalizerCustomFilter = "sorani_normalization"
	NormalizerCustomFilterTrim                 NormalizerCustomFilter = "trim"
	NormalizerCustomFilterUppercase            NormalizerCustomFilter = "uppercase"
)

type NormalizerCustomProperties

type NormalizerCustomProperties func() map[string]interface{}

type NormalizerFunc

type NormalizerFunc func() map[string]interface{}

type OriginFunc

type OriginFunc func(t Temp) ([]byte, error)

type SettingsConfig

type SettingsConfig struct {
	NumberOfShards   int             `json:"number_of_shards,omitempty"`
	NumberOfReplicas int             `json:"number_of_replicas,omitempty"`
	Analysis         *AnalysisConfig `json:"analysis,omitempty"`
}

SettingsConfig{} defines the settings related to an Elasticsearch index, including the number of shards, replicas, and custom analysis configurations.

type Temp

type Temp struct {
	Config Config
	Client searcher
	// contains filtered or unexported fields
}

Temp{} represents temporary data during the migration process, including the direction (up or down).

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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