Documentation ¶
Index ¶
- Variables
- func AliasCreate(es *elasticsearch.Client, alias, indexName string) error
- func AliasDelete(es *elasticsearch.Client, indexName, alias string) error
- func AliasGet(es *elasticsearch.Client, alias string) (indexName string, err error)
- func AliasUpdate(es *elasticsearch.Client, alias, indexName string) (oldIndexName string, err error)
- func IndexCreate(es *elasticsearch.Client, alias, mapping string, withAlias bool) (indexName string, err error)
- func IndexDelete(es *elasticsearch.Client, indexName string) error
- func IndexExists(es *elasticsearch.Client, indexName string) error
- func IndexSwitch(es *elasticsearch.Client, alias, newIndexName string, deleteOldIndex bool) (oldIndexName string, err error)
- func IsMappingValid(es *elasticsearch.Client, indexName string) (bool, error)
- func MappingUpdate(es *elasticsearch.Client, indexName, esMapping string) error
- type ErrorType
- type Proxy
- type QueryBuilder
- type QueryField
- type Transport
Constants ¶
This section is empty.
Variables ¶
var ( ErrAliasNotFound = errors.New("alias not found") ErrAliasAlreadyCreated = errors.New("alias is already created") ErrIndexNotFound = errors.New("index not found") ErrIndexAlreadyCreated = errors.New("index already created") ErrIndexMappingNotValid = errors.New("parsing error in mapping") )
Functions ¶
func AliasCreate ¶ added in v0.1.8
AliasCreate creates an alias for the given indexName.
When the index does not exist ErrIndexNotExists is returned When the alias is already defined, ErrAliasExist is returned
func AliasDelete ¶ added in v0.1.8
AliasDelete removes the alias from the index it is linked to.
When the alias does not it exist it will return a ErrAliasNotExist error.
When the indexName is empty it will search for the indexName using GetAlias().
func AliasGet ¶ added in v0.1.8
AliasGet returns the indexName for the given alias.
When the alias is not found an ErrAliasNotFound error is returned.
func AliasUpdate ¶ added in v0.1.8
func AliasUpdate(es *elasticsearch.Client, alias, indexName string) (oldIndexName string, err error)
AliasUpdate removes the alias if it exists from another index and creates a new one linked to indexName.
It returns an error when the alias cannot be updated. It returns the old indexName that is removed
func IndexCreate ¶ added in v0.1.8
func IndexCreate(es *elasticsearch.Client, alias, mapping string, withAlias bool) (indexName string, err error)
IndexCreate creates a new index with the supplied mapping.
The internal index created from the alias and a timestamp. If 'force' is false, no index is created when the alias exists. When it does not exist a new index is created and the alias is set.
When force is true, there is no check for the alias and no alias is set for created index.
func IndexDelete ¶ added in v0.1.8
IndexDelete delete the index from ElasticSearch.
If the error does not exist an ErrIndexNotExist error is returned.
func IndexExists ¶ added in v0.1.8
func IndexSwitch ¶ added in v0.1.8
func IndexSwitch(es *elasticsearch.Client, alias, newIndexName string, deleteOldIndex bool) (oldIndexName string, err error)
IndexSwitch updates the alias with the new index, and deletes the old index.
When you only want to swith the alias use UpdateAlias().
func IsMappingValid ¶ added in v0.2.0
func MappingUpdate ¶ added in v0.2.0
Types ¶
type ErrorType ¶ added in v0.1.8
type ErrorType struct { Index string Type string Reason string CauseType string CauseReason string }
func GetErrorType ¶ added in v0.1.8
type QueryBuilder ¶ added in v0.1.4
type QueryBuilder struct {
// contains filtered or unexported fields
}
func NewQueryBuilder ¶ added in v0.1.4
func NewQueryBuilder(defaultFields ...QueryField) *QueryBuilder
func (*QueryBuilder) NewElasticQuery ¶ added in v0.1.4
func (qb *QueryBuilder) NewElasticQuery(q *search.QueryTerm) elastic.Query
type QueryField ¶ added in v0.1.4
type Transport ¶ added in v0.1.8
type Transport struct{}
Transport implements the estransport interface with the github.com/valyala/fasthttp HTTP client.
adapted from https://github.com/elastic/go-elasticsearch/blob/master/_examples/fasthttp/fasthttp.go