elastigo: github.com/mattbaird/elastigo/lib Index | Examples | Files

package elastigo

import "github.com/mattbaird/elastigo/lib"

Copyright 2013 Matthew Baird Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2013 Matthew Baird Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Examples

Package Files

baserequest.go baseresponse.go cataliasinfo.go catindexinfo.go catnodeinfo.go catresponses.go catshardinfo.go clusterhealth.go clusterhealthresponses.go clusternodeshotthreads.go clusternodesinfo.go clusternodesshutdown.go clusternodesstats.go clusterreroute.go clusterstate.go clusterstatresponses.go clusterupdatesettings.go connection.go corebulk.go corebulkudp.go corecount.go coredelete.go coredeletebyquery.go coreexplain.go coreget.go coreindex.go coremget.go coremorelikethis.go coremsearch.go corepercolate.go coresearch.go coreupdate.go corevalidate.go error.go indicesaliases.go indicesanalyze.go indicesclearcache.go indicescreateindex.go indicesdeleteindex.go indicesdeletemapping.go indicesdoc.go indicesflush.go indicesgetsettings.go indicesindicesexists.go indicesopencloseindex.go indicesoptimize.go indicesputmapping.go indicesputsettings.go indicesrefresh.go indicessegments.go indicessnapshot.go indicesstats.go indicesstatus.go indicestemplates.go indicesupdatesettings.go request.go searchaggregate.go searchdsl.go searchfacet.go searchfilter.go searchhighlight.go searchquery.go searchsearch.go searchsort.go shared.go snapshot.go

Constants

const (
    Version         = "0.0.2"
    DefaultProtocol = "http"
    DefaultDomain   = "localhost"
    DefaultPort     = "9200"
    // A decay duration of zero results in the default behaviour
    DefaultDecayDuration = 0
)
const (
    // Max buffer size in bytes before flushing to elasticsearch
    BulkMaxBuffer = 16384
    // Max number of Docs to hold in buffer before forcing flush
    BulkMaxDocs = 100
    // Max delay before forcing a flush to Elasticearch
    BulkDelaySeconds = 5
    // maximum wait shutdown seconds
    MAX_SHUTDOWN_SECS = 5
)

Variables

var ErrInvalidAliasLine = errors.New("Cannot parse aliasline")
var ErrInvalidIndexLine = errors.New("Cannot parse indexline")
var ErrInvalidShardLine = errors.New("Cannot parse shardline")
var RecordNotFound = errors.New("record not found")

404 Response.

func Escape Uses

func Escape(args map[string]interface{}) (s string, err error)

func GetIndexUrl Uses

func GetIndexUrl(index string, _type string, id string, parentId string, version int, op_type string,
    routing string, timestamp string, ttl int, percolate string, timeout string, refresh bool) (retval string, e error)

func ScrollDuration Uses

func ScrollDuration(duration string) string

func WriteBulkBytes Uses

func WriteBulkBytes(op string, index string, _type string, id, parent, ttl string, date *time.Time, data interface{}) ([]byte, error)

Given a set of arguments for index, type, id, data create a set of bytes that is formatted for bulkd index http://www.elasticsearch.org/guide/reference/api/bulk.html

type AggregateDsl Uses

type AggregateDsl struct {
    Name          string
    TypeName      string
    Type          interface{}
    Filters       *FilterWrap              `json:"filters,omitempty"`
    AggregatesVal map[string]*AggregateDsl `json:"aggregations,omitempty"`
}

func Aggregate Uses

func Aggregate(name string) *AggregateDsl

func (*AggregateDsl) Aggregates Uses

func (d *AggregateDsl) Aggregates(aggs ...*AggregateDsl) *AggregateDsl

*

* Aggregates accepts n "sub-aggregates" to be applied to this aggregate
*
* agg := Aggregate("user").Term("user_id")
* agg.Aggregates(
*   Aggregate("total_spent").Sum("price"),
*   Aggregate("total_saved").Sum("discount"),
* )

func (*AggregateDsl) Avg Uses

func (d *AggregateDsl) Avg(field string) *AggregateDsl

func (*AggregateDsl) Cardinality Uses

func (d *AggregateDsl) Cardinality(field string, rehash bool, threshold int) *AggregateDsl

*

* Cardinality(
*	 "field_name",
*	 true,
*   0,
* )

func (*AggregateDsl) DateHistogram Uses

func (d *AggregateDsl) DateHistogram(field, interval string) *AggregateDsl

func (*AggregateDsl) ExtendedStats Uses

func (d *AggregateDsl) ExtendedStats(field string) *AggregateDsl

func (*AggregateDsl) Filter Uses

func (d *AggregateDsl) Filter(filters ...interface{}) *AggregateDsl

func (*AggregateDsl) Global Uses

func (d *AggregateDsl) Global() *AggregateDsl

func (*AggregateDsl) Histogram Uses

func (d *AggregateDsl) Histogram(field string, interval int) *AggregateDsl

func (*AggregateDsl) MarshalJSON Uses

func (d *AggregateDsl) MarshalJSON() ([]byte, error)

func (*AggregateDsl) Max Uses

func (d *AggregateDsl) Max(field string) *AggregateDsl

func (*AggregateDsl) Min Uses

func (d *AggregateDsl) Min(field string) *AggregateDsl

func (*AggregateDsl) Missing Uses

func (d *AggregateDsl) Missing(field string) *AggregateDsl

func (*AggregateDsl) Percentiles Uses

func (d *AggregateDsl) Percentiles(field string) *AggregateDsl

func (*AggregateDsl) SignificantTerms Uses

func (d *AggregateDsl) SignificantTerms(field string) *AggregateDsl

func (*AggregateDsl) Stats Uses

func (d *AggregateDsl) Stats(field string) *AggregateDsl

func (*AggregateDsl) Sum Uses

func (d *AggregateDsl) Sum(field string) *AggregateDsl

func (*AggregateDsl) Terms Uses

func (d *AggregateDsl) Terms(field string) *AggregateDsl

func (*AggregateDsl) TermsWithSize Uses

func (d *AggregateDsl) TermsWithSize(field string, size int) *AggregateDsl

func (*AggregateDsl) ValueCount Uses

func (d *AggregateDsl) ValueCount(field string) *AggregateDsl

type AllocateCommand Uses

type AllocateCommand struct {
    Index        string `json:"index"`
    Shard        string `json:"shard"`
    Node         string `json:"node"`
    AllowPrimary bool   `json:"allow_primary,omitempty"`
}

type AnalyzeResponse Uses

type AnalyzeResponse struct {
    Tokens []Token `json:"tokens"`
}

type AnalyzerOptions Uses

type AnalyzerOptions struct {
    Path  string `json:"path,omitempty"`
    Index string `json:"index,omitempty"`
}

type BaseResponse Uses

type BaseResponse struct {
    Ok      bool             `json:"ok"`
    Index   string           `json:"_index,omitempty"`
    Type    string           `json:"_type,omitempty"`
    Id      string           `json:"_id,omitempty"`
    Source  *json.RawMessage `json:"_source,omitempty"` // depends on the schema you've defined
    Version int              `json:"_version,omitempty"`
    Found   bool             `json:"found,omitempty"`
    Exists  bool             `json:"exists,omitempty"`
    Created bool             `json:"created,omitempty"`
    Matches []string         `json:"matches,omitempty"` // percolate matches
}

type BoolClause Uses

type BoolClause string

BoolClause represents aa bool (and/or) clause for use with FilterWrap Legacy, use new FilterOp functions instead

type BulkIndexer Uses

type BulkIndexer struct {

    // We are creating a variable defining the func responsible for sending
    // to allow a mock sendor for test purposes
    Sender func(*bytes.Buffer) error

    // The refresh parameter can be set to true in order to refresh the
    // relevant primary and replica shards immediately after the bulk
    // operation has occurred
    Refresh bool

    // If we encounter an error in sending, we are going to retry for this long
    // before returning an error
    // if 0 it will not retry
    RetryForSeconds int

    // channel for getting errors
    ErrorChannel chan *ErrorBuffer

    // Buffer for Max number of time before forcing flush
    BufferDelayMax time.Duration
    // Max buffer size in bytes before flushing to elasticsearch
    BulkMaxBuffer int // 1048576
    // Max number of Docs to hold in buffer before forcing flush
    BulkMaxDocs int // 100
    // contains filtered or unexported fields
}

A bulk indexer creates goroutines, and channels for connecting and sending data to elasticsearch in bulk, using buffers.

The inspecting the response

Code:

c := elastigo.NewConn()

indexer := c.NewBulkIndexer(10)
// Create a custom Sender Func, to allow inspection of response/error
indexer.Sender = func(buf *bytes.Buffer) error {
    // @buf is the buffer of docs about to be written
    respJson, err := c.DoCommand("POST", "/_bulk", nil, buf)
    if err != nil {
        // handle it better than this
        fmt.Println(string(respJson))
    }
    return err
}
indexer.Start()
for i := 0; i < 20; i++ {
    indexer.Index("twitter", "user", strconv.Itoa(i), "", "", nil, `{"name":"bob"}`)
}
indexer.Stop()

The simplest usage of background bulk indexing

Code:

c := elastigo.NewConn()

indexer := c.NewBulkIndexerErrors(10, 60)
indexer.Start()
indexer.Index("twitter", "user", "1", "", "", nil, `{"name":"bob"}`)
indexer.Stop()

func (*BulkIndexer) Delete Uses

func (b *BulkIndexer) Delete(index, _type, id string)

func (*BulkIndexer) Flush Uses

func (b *BulkIndexer) Flush()

Flush all current documents to ElasticSearch

func (*BulkIndexer) Index Uses

func (b *BulkIndexer) Index(index string, _type string, id, parent, ttl string, date *time.Time, data interface{}) error

The index bulk API adds or updates a typed JSON document to a specific index, making it searchable. it operates by buffering requests, and ocassionally flushing to elasticsearch http://www.elasticsearch.org/guide/reference/api/bulk.html

func (*BulkIndexer) NumErrors Uses

func (b *BulkIndexer) NumErrors() uint64

func (*BulkIndexer) PendingDocuments Uses

func (b *BulkIndexer) PendingDocuments() int

func (*BulkIndexer) Send Uses

func (b *BulkIndexer) Send(buf *bytes.Buffer) error

This does the actual send of a buffer, which has already been formatted into bytes of ES formatted bulk data

func (*BulkIndexer) Start Uses

func (b *BulkIndexer) Start()

Starts this bulk Indexer running, this Run opens a go routine so is Non blocking

func (*BulkIndexer) Stop Uses

func (b *BulkIndexer) Stop()

Stop stops the bulk indexer, blocking the caller until it is complete.

func (*BulkIndexer) Update Uses

func (b *BulkIndexer) Update(index string, _type string, id, parent, ttl string, date *time.Time, data interface{}) error

func (*BulkIndexer) UpdateWithPartialDoc Uses

func (b *BulkIndexer) UpdateWithPartialDoc(index string, _type string, id, parent, ttl string, date *time.Time, partialDoc interface{}, upsert bool) error

func (*BulkIndexer) UpdateWithWithScript Uses

func (b *BulkIndexer) UpdateWithWithScript(index string, _type string, id, parent, ttl string, date *time.Time, script string) error

type CPU Uses

type CPU struct {
    Vendor           string `json:"vendor,omitempty"`
    Model            string `json:"model,omitempty"`
    Mhz              int    `json:"mhz,omitempty"`
    TotalCores       int    `json:"total_cores,omitempty"`
    TotalSockets     int    `json:"total_sockets,omitempty"`
    CoresPerSocket   int    `json:"cores_per_socket,omitempty"`
    CacheSizeInBytes int    `json:"cache_size_in_bytes,omitempty"`
}

type CancelCommand Uses

type CancelCommand struct {
    Index        string `json:"index"`
    Shard        string `json:"shard"`
    Node         string `json:"node"`
    AllowPrimary bool   `json:"allow_primary,omitempty"`
}

type Cardinality Uses

type Cardinality struct {
    Field              string  `json:"field"`
    PrecisionThreshold float64 `json:"precision_threshold,omitempty"`
    Rehash             bool    `json:"rehash,omitempty"`
}

type CatAliasInfo Uses

type CatAliasInfo struct {
    Name  string
    Index string
}

func NewCatAliasInfo Uses

func NewCatAliasInfo(aliasLine string) (catAlias *CatAliasInfo, err error)

Create an AliasInfo from the string _cat/alias would produce EX: alias alias i production production_20160405075824

type CatIndexDocs Uses

type CatIndexDocs struct {
    Count   int64
    Deleted int64
}

type CatIndexInfo Uses

type CatIndexInfo struct {
    Health   string
    Status   string
    Name     string
    Shards   int
    Replicas int
    Docs     CatIndexDocs
    Store    CatIndexStore
}

func NewCatIndexInfo Uses

func NewCatIndexInfo(indexLine string) (catIndex *CatIndexInfo, err error)

Create an IndexInfo from the string _cat/indices would produce EX: health status index pri rep docs.count docs.deleted store.size pri.store.size green open logs-2015-06-19 2 0 135389346 0 53048922233 53048922233

type CatIndexStore Uses

type CatIndexStore struct {
    Size    int64
    PriSize int64
}

type CatNodeInfo Uses

type CatNodeInfo struct {
    Id                 string
    PID                string
    Host               string
    IP                 string
    Port               string
    Version            string
    Build              string
    JDK                string
    DiskAvail          string
    HeapCur            string
    HeapPerc           string
    HeapMax            string
    RamCur             string
    RamPerc            int16
    RamMax             string
    FileDescCur        string
    FileDescPerc       string
    FileDescMax        string
    Load               string
    UpTime             string
    NodeRole           string
    Master             string
    Name               string
    CmpltSize          string
    FieldMem           int
    FieldEvict         int
    FiltMem            int
    FiltEvict          int
    FlushTotal         int
    FlushTotalTime     string
    GetCur             string
    GetTime            string
    GetTotal           string
    GetExistsTime      string
    GetExistsTotal     string
    GetMissingTime     string
    GetMissingTotal    string
    IDCacheMemory      int
    IdxDelCur          string
    IdxDelTime         string
    IdxDelTotal        string
    IdxIdxCur          string
    IdxIdxTime         string
    IdxIdxTotal        string
    MergCur            string
    MergCurDocs        string
    MergCurSize        string
    MergTotal          string
    MergTotalDocs      string
    MergTotalSize      string
    MergTotalTime      string
    PercCur            string
    PercMem            string
    PercQueries        string
    PercTime           string
    PercTotal          string
    RefreshTotal       string
    RefreshTime        string
    SearchFetchCur     string
    SearchFetchTime    string
    SearchFetchTotal   string
    SearchOpenContexts string
    SearchQueryCur     string
    SearchQueryTime    string
    SearchQueryTotal   string
    SegCount           string
    SegMem             string
    SegIdxWriterMem    string
    SegIdxWriterMax    string
    SegVerMapMem       string
}

type CatShardInfo Uses

type CatShardInfo struct {
    IndexName string
    Shard     int
    Primary   string
    State     string
    Docs      int64
    Store     int64
    NodeIP    string
    NodeName  string
}

func NewCatShardInfo Uses

func NewCatShardInfo(rawCat string) (catshard *CatShardInfo, err error)

Create a CatShard from a line of the raw output of a _cat/shards

func (*CatShardInfo) String Uses

func (s *CatShardInfo) String() string

Print shard info

type CatShards Uses

type CatShards []CatShardInfo

func (*CatShards) String Uses

func (s *CatShards) String() string

Stringify the shards

type Cluster Uses

type Cluster struct {
    Name string `json:"name"`
}

type ClusterHealthResponse Uses

type ClusterHealthResponse struct {
    ClusterName         string `json:"cluster_name"`
    Status              string `json:"status"`
    TimedOut            bool   `json:"timed_out"`
    NumberOfNodes       int    `json:"number_of_nodes"`
    NumberOfDataNodes   int    `json:"number_of_data_nodes"`
    ActivePrimaryShards int    `json:"active_primary_shards"`
    ActiveShards        int    `json:"active_shards"`
    RelocatingShards    int    `json:"relocating_shards"`
    InitializingShards  int    `json:"initializing_shards"`
    UnassignedShards    int    `json:"unassigned_shards"`
}

type ClusterSettingsResponse Uses

type ClusterSettingsResponse struct {
    Transient  map[string]int `json:"transient"`
    Persistent map[string]int `json:"persistent"`
}

type ClusterStateFilter Uses

type ClusterStateFilter struct {
    FilterNodes        bool
    FilterRoutingTable bool
    FilterMetadata     bool
    FilterBlocks       bool
    FilterIndices      []string
}

func (ClusterStateFilter) Parameterize Uses

func (f ClusterStateFilter) Parameterize() []string

type ClusterStateIndiceResponse Uses

type ClusterStateIndiceResponse struct {
    State string `json:"state"`
}

type ClusterStateMetadataResponse Uses

type ClusterStateMetadataResponse struct {
    // TODO: templates
    Indices map[string]ClusterStateIndiceResponse `json:"indices"`
}

type ClusterStateNodeResponse Uses

type ClusterStateNodeResponse struct {
    Name             string `json:"name"`
    TransportAddress string `json:"transport_address"`
}

type ClusterStateResponse Uses

type ClusterStateResponse struct {
    ClusterName string                              `json:"cluster_name"`
    MasterNode  string                              `json:"master_node"`
    Nodes       map[string]ClusterStateNodeResponse `json:"nodes"`
    Metadata    ClusterStateMetadataResponse        `json:"metadata"`
}

type ClusterStateRoutingTableResponse Uses

type ClusterStateRoutingTableResponse struct {
}

type Commands Uses

type Commands struct {
    Commands []interface{} `json:"commands"`
}

type Conn Uses

type Conn struct {
    // Maintain these for backwards compatibility
    Protocol       string
    Domain         string
    ClusterDomains []string
    Port           string
    Username       string
    Password       string
    Hosts          []string
    Gzip           bool
    RequestTracer  func(method, url, body string)

    // To compute the weighting scores, we perform a weighted average of recent response times,
    // over the course of `DecayDuration`. DecayDuration may be set to 0 to use the default
    // value of 5 minutes. The EpsilonValueCalculator uses this to calculate a score
    // from the weighted average response time.
    DecayDuration time.Duration
    // contains filtered or unexported fields
}

func NewConn Uses

func NewConn() *Conn

func (*Conn) AddAlias Uses

func (c *Conn) AddAlias(index string, alias string) (BaseResponse, error)

The API allows you to create an index alias through an API.

func (*Conn) AllNodesInfo Uses

func (c *Conn) AllNodesInfo() (NodeInfo, error)

The cluster nodes info API allows to retrieve one or more (or all) of the cluster nodes information. information can be one of jvm, process

func (*Conn) AnalyzeIndices Uses

func (c *Conn) AnalyzeIndices(index string, args map[string]interface{}) (AnalyzeResponse, error)

AnalyzeIndices performs the analysis process on a text and return the tokens breakdown of the text. http://www.elasticsearch.org/guide/reference/api/admin-indices-analyze/

func (*Conn) ClearCache Uses

func (c *Conn) ClearCache(clearId bool, clearBloom bool, args map[string]interface{}, indices ...string) (ExtendedStatus, error)

ClearCache allows to clear either all caches or specific cached associated with one ore more indices. see http://www.elasticsearch.org/guide/reference/api/admin-indices-clearcache/

func (*Conn) Close Uses

func (c *Conn) Close()

func (*Conn) CloseIndex Uses

func (c *Conn) CloseIndex(index string) (BaseResponse, error)

func (*Conn) CloseIndices Uses

func (c *Conn) CloseIndices() (BaseResponse, error)

func (*Conn) ClusterState Uses

func (c *Conn) ClusterState(filter ClusterStateFilter) (ClusterStateResponse, error)

func (*Conn) Count Uses

func (c *Conn) Count(index string, _type string, args map[string]interface{}, query interface{}) (CountResponse, error)

Count allows the caller to easily execute a query and get the number of matches for that query. It can be executed across one or more indices and across one or more types. The query can either be provided using a simple query string as a parameter, or using the Query DSL defined within the request body. http://www.elasticsearch.org/guide/reference/api/count.html

func (*Conn) CreateIndex Uses

func (c *Conn) CreateIndex(index string) (BaseResponse, error)

The create API allows you to create an indices through an API.

func (*Conn) CreateIndexWithSettings Uses

func (c *Conn) CreateIndexWithSettings(index string, settings interface{}) (BaseResponse, error)

The create API allows you to create an indices through an API.

func (*Conn) CreateSnapshotRepository Uses

func (c *Conn) CreateSnapshotRepository(name string, args map[string]interface{}, settings interface{}) (BaseResponse, error)

CreateSnapshotRepository creates a new snapshot repository on the cluster http://www.elastic.co/guide/en/elasticsearch/reference/1.3/modules-snapshots.html

func (*Conn) Delete Uses

func (c *Conn) Delete(index string, _type string, id string, args map[string]interface{}) (BaseResponse, error)

Delete API allows to delete a typed JSON document from a specific index based on its id. http://www.elasticsearch.org/guide/reference/api/delete.html

func (*Conn) DeleteByQuery Uses

func (c *Conn) DeleteByQuery(indices []string, types []string, args map[string]interface{}, query interface{}) (BaseResponse, error)

DeleteByQuery allows the caller to delete documents from one or more indices and one or more types based on a query. The query can either be provided using a simple query string as a parameter, or using the Query DSL defined within the request body. see: http://www.elasticsearch.org/guide/reference/api/delete-by-query.html

func (*Conn) DeleteIndex Uses

func (c *Conn) DeleteIndex(index string) (BaseResponse, error)

The delete API allows you to delete one or more indices through an API. This operation may fail if the elasticsearch configuration has been set to forbid deleting indexes.

func (*Conn) DeleteMapping Uses

func (c *Conn) DeleteMapping(index string, typeName string) (BaseResponse, error)

The delete API allows you to delete a mapping through an API.

func (*Conn) DoCommand Uses

func (c *Conn) DoCommand(method string, url string, args map[string]interface{}, data interface{}) ([]byte, error)

func (*Conn) Exists Uses

func (c *Conn) Exists(index string, _type string, id string, args map[string]interface{}) (BaseResponse, error)

Exists allows the caller to check for the existence of a document using HEAD This appears to be broken in the current version of elasticsearch 0.19.10, currently returning nothing

func (*Conn) ExistsBool Uses

func (c *Conn) ExistsBool(index string, _type string, id string, args map[string]interface{}) (bool, error)

ExistsBool allows caller to check for the existence of a document using HEAD TODO(shutej): This looks redundant with the Exists function in baserequest.go, check with mattbaird@.

func (*Conn) ExistsIndex Uses

func (c *Conn) ExistsIndex(index string, _type string, args map[string]interface{}) (bool, error)

ExistsIndex allows caller to check for the existence of an index or a type using HEAD

func (*Conn) Explain Uses

func (c *Conn) Explain(index string, _type string, id string, args map[string]interface{}, query string) (Match, error)

Explain computes a score explanation for a query and a specific document. This can give useful feedback whether a document matches or didn’t match a specific query. This feature is available from version 0.19.9 and up. see http://www.elasticsearch.org/guide/reference/api/explain.html

func (*Conn) Flush Uses

func (c *Conn) Flush(indices ...string) (BaseResponse, error)

Flush flushes one or more indices through an API. The flush process of an index basically frees memory from the index by flushing data to the index storage and clearing the internal transaction log. By default, ElasticSearch uses memory heuristics in order to automatically trigger flush operations as required in order to clear memory. http://www.elasticsearch.org/guide/reference/api/admin-indices-flush.html TODO: add Shards to response

func (*Conn) Get Uses

func (c *Conn) Get(index string, _type string, id string, args map[string]interface{}) (BaseResponse, error)

The get API allows to get a typed JSON document from the index based on its id. GET - retrieves the doc HEAD - checks for existence of the doc http://www.elasticsearch.org/guide/reference/api/get.html TODO: make this implement an interface

func (*Conn) GetCatAliasInfo Uses

func (c *Conn) GetCatAliasInfo(pattern string) (catAliases []CatAliasInfo)

Pull all the alias info from the connection

func (*Conn) GetCatIndexInfo Uses

func (c *Conn) GetCatIndexInfo(pattern string) (catIndices []CatIndexInfo)

Pull all the index info from the connection

func (*Conn) GetCatNodeInfo Uses

func (c *Conn) GetCatNodeInfo(fields []string) (catNodes []CatNodeInfo, err error)

GetCatNodeInfo issues an elasticsearch cat nodes request with the specified fields and returns a list of CatNodeInfos, one for each node, whose requested members are populated with statistics. If fields is nil or empty, the default cat output is used. NOTE: if you include the name field, make sure it is the last field in the list, because name values can contain spaces which screw up the parsing

func (*Conn) GetCatShards Uses

func (c *Conn) GetCatShards() (shards CatShards)

Get all the shards, even the bad ones

func (*Conn) GetCustom Uses

func (c *Conn) GetCustom(index string, _type string, id string, args map[string]interface{}, source *json.RawMessage) (BaseResponse, error)

Same as Get but with custom source type.

func (*Conn) GetSnapshotByName Uses

func (c *Conn) GetSnapshotByName(repository, name string, args map[string]interface{}) (GetSnapshotsResponse, error)

GetSnapshots returns all snapshot of the specified name for a specific repository http://www.elastic.co/guide/en/elasticsearch/reference/1.3/modules-snapshots.html

func (*Conn) GetSnapshots Uses

func (c *Conn) GetSnapshots(repository string, args map[string]interface{}) (GetSnapshotsResponse, error)

GetSnapshots returns all snapshot for a specific repository http://www.elastic.co/guide/en/elasticsearch/reference/1.3/modules-snapshots.html

func (*Conn) GetSource Uses

func (c *Conn) GetSource(index string, _type string, id string, args map[string]interface{}, source interface{}) error

GetSource retrieves the document by id and converts it to provided interface

func (*Conn) Health Uses

func (c *Conn) Health(indices ...string) (ClusterHealthResponse, error)

The cluster health API allows to get a very simple status on the health of the cluster. see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-health.html TODO: implement wait_for_status, timeout, wait_for_relocating_shards, wait_for_nodes TODO: implement level (Can be one of cluster, indices or shards. Controls the details level of the health information returned. Defaults to cluster.)

func (*Conn) Index Uses

func (c *Conn) Index(index string, _type string, id string, args map[string]interface{}, data interface{}) (BaseResponse, error)

Index adds or updates a typed JSON document in a specific index, making it searchable, creating an index if it did not exist. if id is omited, op_type 'create' will be passed and http method will default to "POST" _type is optional id is optional parentId is optional version is optional op_type is optional routing is optional timestamp is optional ttl is optional percolate is optional timeout is optional http://www.elasticsearch.org/guide/reference/api/index_.html

func (*Conn) IndexWithParameters Uses

func (c *Conn) IndexWithParameters(index string, _type string, id string, parentId string, version int, op_type string,
    routing string, timestamp string, ttl int, percolate string, timeout string, refresh bool,
    args map[string]interface{}, data interface{}) (BaseResponse, error)

IndexWithParameters takes all the potential parameters available

func (*Conn) IndicesExists Uses

func (c *Conn) IndicesExists(indices ...string) (bool, error)

IndicesExists checks for the existence of indices. uses RecordNotFound message if it doesn't exist and "no error" situation if it exists. If there is some other error, gives the error and says it exists just in case see http://www.elasticsearch.org/guide/reference/api/admin-indices-indices-exists/

func (*Conn) MGet Uses

func (c *Conn) MGet(index string, _type string, mgetRequest MGetRequestContainer, args map[string]interface{}) (MGetResponseContainer, error)

MGet allows the caller to get multiple documents based on an index, type (optional) and id (and possibly routing). The response includes a docs array with all the fetched documents, each element similar in structure to a document provided by the get API. see http://www.elasticsearch.org/guide/reference/api/multi-get.html

func (*Conn) MoreLikeThis Uses

func (c *Conn) MoreLikeThis(index string, _type string, id string, args map[string]interface{}, query MoreLikeThisQuery) (BaseResponse, error)

MoreLikeThis allows the caller to get documents that are “like” a specified document. http://www.elasticsearch.org/guide/reference/api/more-like-this.html

func (*Conn) NewBulkIndexer Uses

func (c *Conn) NewBulkIndexer(maxConns int) *BulkIndexer

func (*Conn) NewBulkIndexerErrors Uses

func (c *Conn) NewBulkIndexerErrors(maxConns, retrySeconds int) *BulkIndexer

A bulk indexer with more control over error handling

 @maxConns is the max number of in flight http requests
 @retrySeconds is # of seconds to wait before retrying falied requests

done := make(chan bool)
BulkIndexerGlobalRun(100, done)

func (*Conn) NewRequest Uses

func (c *Conn) NewRequest(method, path, query string) (*Request, error)

func (*Conn) NodesInfo Uses

func (c *Conn) NodesInfo(information []string, nodes ...string) (NodeInfo, error)

func (*Conn) NodesShutdown Uses

func (c *Conn) NodesShutdown(delay int, nodes ...string) error

NodesShutdown allows the caller to shutdown between one and all nodes in the cluster delay is a integer representing number of seconds passing "" or "_all" for the nodes parameter will shut down all nodes see http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/

func (*Conn) NodesStats Uses

func (c *Conn) NodesStats() (NodeStatsResponse, error)

func (*Conn) OpenIndex Uses

func (c *Conn) OpenIndex(index string) (BaseResponse, error)

func (*Conn) OpenIndices Uses

func (c *Conn) OpenIndices() (BaseResponse, error)

func (*Conn) OptimizeIndices Uses

func (c *Conn) OptimizeIndices(args map[string]interface{}, indices ...string) (ExtendedStatus, error)

AnalyzeIndices performs the analysis process on a text and return the tokens breakdown of the text. http://www.elasticsearch.org/guide/reference/api/admin-indices-analyze/

func (*Conn) Percolate Uses

func (c *Conn) Percolate(index string, _type string, name string, args map[string]interface{}, doc string) (PercolatorResult, error)

func (*Conn) PutMapping Uses

func (c *Conn) PutMapping(index string, typeName string, instance interface{}, opt MappingOptions) error

func (*Conn) PutMappingFromJSON Uses

func (c *Conn) PutMappingFromJSON(index string, typeName string, mapping []byte) error

Same as PutMapping, but takes a []byte for mapping and provides no check of structure

func (*Conn) PutSettings Uses

func (c *Conn) PutSettings(index string, settings interface{}) (BaseResponse, error)

func (*Conn) Refresh Uses

func (c *Conn) Refresh(indices ...string) (BaseResponse, error)

Refresh explicitly refreshes one or more index, making all operations performed since the last refresh available for search. The (near) real-time capabilities depend on the index engine used. For example, the internal one requires refresh to be called, but by default a refresh is scheduled periodically. http://www.elasticsearch.org/guide/reference/api/admin-indices-refresh.html TODO: add Shards to response

func (*Conn) RegisterPercolate Uses

func (c *Conn) RegisterPercolate(index string, id string, data interface{}) (BaseResponse, error)

See http://www.elasticsearch.org/guide/reference/api/percolate.html

func (*Conn) Reroute Uses

func (c *Conn) Reroute(dryRun bool, commands Commands) (ClusterHealthResponse, error)

The cluster health API allows to get a very simple status on the health of the cluster. see http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html information returned. Defaults to cluster.)

func (*Conn) RestoreSnapshot Uses

func (c *Conn) RestoreSnapshot(repository, name string, args map[string]interface{}, query interface{}) (BaseResponse, error)

RestoreSnapshot restores a snapshot of the current state of the cluster with a specific name and for a existing repositoriy http://www.elastic.co/guide/en/elasticsearch/reference/1.3/modules-snapshots.html

func (*Conn) Scroll Uses

func (c *Conn) Scroll(args map[string]interface{}, scroll_id string) (SearchResult, error)

func (*Conn) Search Uses

func (c *Conn) Search(index string, _type string, args map[string]interface{}, query interface{}) (SearchResult, error)

Search performs a very basic search on an index via the request URI API.

params:

@index:  the elasticsearch index
@_type:  optional ("" if not used) search specific type in this index
@args:   a map of URL parameters. Allows all the URI-request parameters allowed by ElasticSearch.
@query:  this can be one of 3 types:
           1)  string value that is valid elasticsearch
           2)  io.Reader that can be set in body (also valid elasticsearch string syntax..)
           3)  other type marshalable to json (also valid elasticsearch json)

out, err := Search(true, "github", map[string]interface{} {"from" : 10}, qryType)

http://www.elasticsearch.org/guide/reference/api/search/uri-request.html

func (*Conn) SearchUri Uses

func (c *Conn) SearchUri(index, _type string, args map[string]interface{}) (SearchResult, error)

SearchUri performs the simplest possible query in url string params:

@index:  the elasticsearch index
@_type:  optional ("" if not used) search specific type in this index
@args: a map of URL parameters. Most important one is q

out, err := SearchUri("github","", map[string]interface{} { "q" : `user:kimchy`})

produces a request like this: host:9200/github/_search?q=user:kimchy"

http://www.elasticsearch.org/guide/reference/api/search/uri-request.html

func (*Conn) SetFromUrl Uses

func (c *Conn) SetFromUrl(u string) error

func (*Conn) SetHosts Uses

func (c *Conn) SetHosts(newhosts []string)

func (*Conn) SetPort Uses

func (c *Conn) SetPort(port string)

func (*Conn) Snapshot Uses

func (c *Conn) Snapshot(indices ...string) (ExtendedStatus, error)

Snapshot allows to explicitly perform a snapshot through the gateway of one or more indices (backup them). By default, each index gateway periodically snapshot changes, though it can be disabled and be controlled completely through this API. see http://www.elasticsearch.org/guide/reference/api/admin-indices-gateway-snapshot/

func (*Conn) Status Uses

func (c *Conn) Status(args map[string]interface{}, indices ...string) (BaseResponse, error)

Status lists status details of all indices or the specified index. http://www.elasticsearch.org/guide/reference/api/admin-indices-status.html

func (*Conn) Suggest Uses

func (c *Conn) Suggest(index string, args map[string]interface{}, query interface{}) (SuggestResults, error)

func (*Conn) TakeSnapshot Uses

func (c *Conn) TakeSnapshot(repository, name string, args map[string]interface{}, query interface{}) (BaseResponse, error)

TakeSnapshot takes a snapshot of the current state of the cluster with a specific name and for a existing repositoriy http://www.elastic.co/guide/en/elasticsearch/reference/1.3/modules-snapshots.html

func (*Conn) Update Uses

func (c *Conn) Update(index string, _type string, id string, args map[string]interface{}, data interface{}) (BaseResponse, error)

Update updates a document based on a script provided. The operation gets the document (collocated with the shard) from the index, runs the script (with optional script language and parameters), and index back the result (also allows to delete, or ignore the operation). It uses versioning to make sure no updates have happened during the “get” and “reindex”. (available from 0.19 onwards). Note, this operation still means full reindex of the document, it just removes some network roundtrips and reduces chances of version conflicts between the get and the index. The _source field need to be enabled for this feature to work.

http://www.elasticsearch.org/guide/reference/api/update.html TODO: finish this, it's fairly complex

func (*Conn) UpdateSetting Uses

func (c *Conn) UpdateSetting(args map[string]interface{}, filter_indices ...string) (ClusterStateResponse, error)

State gets the comprehensive state information for the whole cluster see http://www.elasticsearch.org/guide/reference/api/admin-cluster-state/

func (*Conn) UpdateSettings Uses

func (c *Conn) UpdateSettings(settingType string, key string, value int) (ClusterSettingsResponse, error)

UpdateSettings allows to update cluster wide specific settings. Defaults to Transient setting Settings updated can either be persistent (applied cross restarts) or transient (will not survive a full cluster restart). http://www.elasticsearch.org/guide/reference/api/admin-cluster-update-settings.html

func (*Conn) UpdateWithPartialDoc Uses

func (c *Conn) UpdateWithPartialDoc(index string, _type string, id string, args map[string]interface{}, doc interface{}, upsert bool) (BaseResponse, error)

UpdateWithPartialDoc updates a document based on partial document provided. The update API also support passing a partial document (since 0.20), which will be merged into the existing document (simple recursive merge, inner merging of objects, replacing core "keys/values" and arrays). If both doc and script is specified, then doc is ignored. Best is to put your field pairs of the partial document in the script itself.

http://www.elasticsearch.org/guide/reference/api/update.html

func (*Conn) UpdateWithScript Uses

func (c *Conn) UpdateWithScript(index string, _type string, id string, args map[string]interface{}, script string, params interface{}) (BaseResponse, error)

UpdateWithScript updates a document based on a script provided. The operation gets the document (collocated with the shard) from the index, runs the script (with optional script language and parameters), and index back the result (also allows to delete, or ignore the operation). It uses versioning to make sure no updates have happened during the "get" and "reindex". (available from 0.19 onwards).

Note, this operation still means full reindex of the document, it just removes some network roundtrips and reduces chances of version conflicts between the get and the index. The _source field need to be enabled for this feature to work. http://www.elasticsearch.org/guide/reference/api/update.html

func (*Conn) Validate Uses

func (c *Conn) Validate(index string, _type string, args map[string]interface{}) (BaseResponse, error)

Validate allows a user to validate a potentially expensive query without executing it. see http://www.elasticsearch.org/guide/reference/api/validate.html

func (*Conn) WaitForStatus Uses

func (c *Conn) WaitForStatus(status string, timeout int, indices ...string) (ClusterHealthResponse, error)

type CountResponse Uses

type CountResponse struct {
    Count int    `json:"count"`
    Shard Status `json:"_shards"`
}

type DateHistogram Uses

type DateHistogram struct {
    Field    string `json:"field"`
    Interval string `json:"interval"`
}

type DeleteByQueryResponse Uses

type DeleteByQueryResponse struct {
    Status   bool                   `json:"ok"`
    Indicies map[string]IndexStatus `json:"_indices"`
}

type ESError Uses

type ESError struct {
    When time.Time
    What string
    Code int
}

ESError is an error implementation that includes a time, message, and code.

func (ESError) Error Uses

func (e ESError) Error() string

type ErrorBuffer Uses

type ErrorBuffer struct {
    Err error
    Buf *bytes.Buffer
}

type Explaination Uses

type Explaination struct {
    Index string `json:"index"`
    Valid bool   `json:"valid"`
    Error string `json:"error"`
}

type Explanation Uses

type Explanation struct {
    Value       float32        `json:"value"`
    Description string         `json:"description"`
    Details     []*Explanation `json:"details,omitempty"`
}

func (*Explanation) String Uses

func (e *Explanation) String(indent string) string

type ExtendedStatus Uses

type ExtendedStatus struct {
    Ok           StatusBool `json:"ok"`
    ShardsStatus Status     `json:"_shards"`
}

type FacetDsl Uses

type FacetDsl struct {
    Terms  map[string]*Term     `json:"terms,omitempty"`
    Ranges map[string]*RangeDsl `json:"terms,omitempty"`
    // contains filtered or unexported fields
}

func Facet Uses

func Facet() *FacetDsl

"facets": {

    "terms": {
		"terms": {
			"field": [
			  "@fields.category"
			],
			"size": 25
		}
    }

}

"facets": {

"actors": { "terms": {"field": ["actor"],"size": "10" }}
, "langauge": { "terms": {"field": ["repository.language"],"size": "10" }}

}

func (*FacetDsl) Fields Uses

func (m *FacetDsl) Fields(fields ...string) *FacetDsl

func (*FacetDsl) MarshalJSON Uses

func (m *FacetDsl) MarshalJSON() ([]byte, error)

func (*FacetDsl) Range Uses

func (m *FacetDsl) Range(r *RangeDsl) *FacetDsl

func (*FacetDsl) Regex Uses

func (m *FacetDsl) Regex(field, match string) *FacetDsl

func (*FacetDsl) Size Uses

func (m *FacetDsl) Size(size string) *FacetDsl

func (*FacetDsl) Term Uses

func (m *FacetDsl) Term(t *Term) *FacetDsl

type Facets Uses

type Facets struct {
    Tag struct {
        Terms string `json:"terms"`
    } `json:"tag"`
}

type Failure Uses

type Failure struct {
    Index  string    `json:"index"`
    Shard  StatusInt `json:"shard"`
    Reason string    `json:"reason"`
}

func (Failure) String Uses

func (f Failure) String() string

type FieldAggregate Uses

type FieldAggregate struct {
    Field string `json:"field"`
    Size  *int   `json:"size,omitempty"`
}

type FilterClause Uses

type FilterClause interface {
    String() string
}

FilterClause is either a boolClause or FilterOp for use with FilterWrap

type FilterOp Uses

type FilterOp struct {
    TermsMap        map[string]interface{} `json:"terms,omitempty"`
    TermMap         map[string]interface{} `json:"term,omitempty"`
    RangeMap        map[string]RangeFilter `json:"range,omitempty"`
    ExistsProp      *propertyPathMarker    `json:"exists,omitempty"`
    MissingProp     *propertyPathMarker    `json:"missing,omitempty"`
    AndFilters      []*FilterOp            `json:"and,omitempty"`
    OrFilters       []*FilterOp            `json:"or,omitempty"`
    NotFilters      []*FilterOp            `json:"not,omitempty"`
    LimitProp       *LimitFilter           `json:"limit,omitempty"`
    TypeProp        *TypeFilter            `json:"type,omitempty"`
    IdsProp         *IdsFilter             `json:"ids,omitempty"`
    ScriptProp      *ScriptFilter          `json:"script,omitempty"`
    GeoDistMap      map[string]interface{} `json:"geo_distance,omitempty"`
    GeoDistRangeMap map[string]interface{} `json:"geo_distance_range,omitempty"`
}

FilterOp holds all the information for a filter query Properties should not be set directly, but instead via the fluent-style API.

func Filter Uses

func Filter() *FilterOp

Filter creates a blank FilterOp that can be customized with further function calls This is the starting point for constructing any filter query Examples:

Filter().Term("user","kimchy")

// we use variadics to allow n arguments, first is the "field" rest are values
Filter().Terms("user", "kimchy", "elasticsearch")

Filter().Exists("repository.name")

func (*FilterOp) And Uses

func (f *FilterOp) And(filters ...*FilterOp) *FilterOp

And will add an AND op to the filter. One or more FilterOps can be passed in.

func (*FilterOp) Exists Uses

func (f *FilterOp) Exists(field string) *FilterOp

Exists adds an EXISTS op to the filter.

func (*FilterOp) GeoDistance Uses

func (f *FilterOp) GeoDistance(distance string, fields ...GeoField) *FilterOp

GeoDistance will add a GEO DISTANCE op to the filter. distance: distance in ES distance format, i.e. "100km" or "100mi". fields: an array of GeoField origin coordinates. Only one coordinate needs to match.

func (*FilterOp) GeoDistanceRange Uses

func (f *FilterOp) GeoDistanceRange(from string, to string, fields ...GeoField) *FilterOp

GeoDistanceRange will add a GEO DISTANCE RANGE op to the filter. from: minimum distance in ES distance format, i.e. "100km" or "100mi". to: maximum distance in ES distance format, i.e. "100km" or "100mi". fields: an array of GeoField origin coordinates. Only one coor

func (*FilterOp) Ids Uses

func (f *FilterOp) Ids(ids ...interface{}) *FilterOp

Ids adds a IDS op to the filter.

func (*FilterOp) IdsByTypes Uses

func (f *FilterOp) IdsByTypes(types []string, ids ...interface{}) *FilterOp

IdsByTypes adds a IDS op to the filter, but also allows passing in an array of types for the query.

func (*FilterOp) Limit Uses

func (f *FilterOp) Limit(maxResults int) *FilterOp

Limit adds an LIMIT op to the filter.

func (*FilterOp) Missing Uses

func (f *FilterOp) Missing(field string) *FilterOp

Missing adds an MISSING op to the filter.

func (*FilterOp) Not Uses

func (f *FilterOp) Not(filters ...*FilterOp) *FilterOp

Not will add a NOT op to the filter. One or more FilterOps can be passed in.

func (*FilterOp) Or Uses

func (f *FilterOp) Or(filters ...*FilterOp) *FilterOp

Or will add an OR op to the filter. One or more FilterOps can be passed in.

func (*FilterOp) Range Uses

func (f *FilterOp) Range(field string, gte interface{},
    gt interface{}, lte interface{}, lt interface{}, timeZone string) *FilterOp

Range adds a range filter for the given field. See the RangeFilter struct documentation for information about the parameters.

func (*FilterOp) Term Uses

func (f *FilterOp) Term(field string, value interface{}) *FilterOp

Term will add a term to the filter. Multiple Term filters can be added, and ES will OR them. If the term already exists in the FilterOp, the value will be overridden.

func (*FilterOp) Terms Uses

func (f *FilterOp) Terms(field string, executionMode TermExecutionMode, values ...interface{}) *FilterOp

Terms adds a TERMS op to the filter. field: the document field executionMode Term execution mode, starts with TEM values: array of values to match Note: you can only have one terms clause in a filter. Use a bool filter to combine multiple.

func (*FilterOp) Type Uses

func (f *FilterOp) Type(fieldType string) *FilterOp

Type adds a TYPE op to the filter.

type FilterWrap Uses

type FilterWrap struct {
    // contains filtered or unexported fields
}

FilterWrap is the legacy struct for chaining multiple filters with a bool Legacy, use new FilterOp functions instead

func CompoundFilter Uses

func CompoundFilter(fl ...interface{}) *FilterWrap

CompoundFilter creates a complete FilterWrap given multiple filters Legacy, use new FilterOp functions instead

func NewFilterWrap Uses

func NewFilterWrap() *FilterWrap

NewFilterWrap creates a new FilterWrap struct

func (*FilterWrap) Bool Uses

func (f *FilterWrap) Bool(s string)

Bool sets the type of boolean filter to use. Accepted values are "and" and "or". Legacy, use new FilterOp functions instead

func (*FilterWrap) MarshalJSON Uses

func (f *FilterWrap) MarshalJSON() ([]byte, error)

MarshalJSON override for FilterWrap to match the expected ES syntax with the bool at the root

func (*FilterWrap) String Uses

func (f *FilterWrap) String() string

type Float32Nullable Uses

type Float32Nullable float32

Elasticsearch returns some invalid (according to go) json, with floats having...

json: cannot unmarshal null into Go value of type float32 (see last field.)

"hits":{"total":6808,"max_score":null,

"hits":[{"_index":"10user","_type":"user","_id":"751820","_score":null,

func (*Float32Nullable) UnmarshalJSON Uses

func (i *Float32Nullable) UnmarshalJSON(data []byte) error

type GeoField Uses

type GeoField struct {
    GeoLocation
    Field string
}

GeoField holds a GeoLocation and a field to match to. This exists so the struct will match the ES schema.

func NewGeoField Uses

func NewGeoField(field string, latitude float32, longitude float32) GeoField

NewGeoField is a helper function to create values for the GeoDistance filters

type GeoLocation Uses

type GeoLocation struct {
    Latitude  float32 `json:"lat"`
    Longitude float32 `json:"lon"`
}

GeoLocation holds the coordinates for a geo query. Currently hashes are not supported.

type GetSnapshotsResponse Uses

type GetSnapshotsResponse struct {
    Snapshots []struct {
        Snapshot  string    `json:"snapshot"`
        Indices   []string  `json:"indices"`
        State     string    `json:"state"`
        StartTime time.Time `json:"start_time"`
        EndTime   time.Time `json:"end_time"`
    } `json:"snapshots"`
}

type Highlight Uses

type Highlight map[string][]string

type HighlightDsl Uses

type HighlightDsl struct {
    Settings  *HighlightEmbed           `-`
    TagSchema string                    `json:"tag_schema,omitempty"`
    Fields    map[string]HighlightEmbed `json:"fields,omitempty"`
}

func NewHighlight Uses

func NewHighlight() *HighlightDsl

func (*HighlightDsl) AddField Uses

func (h *HighlightDsl) AddField(name string, settings *HighlightEmbed) *HighlightDsl

func (*HighlightDsl) MarshalJSON Uses

func (t *HighlightDsl) MarshalJSON() ([]byte, error)

Custom marshalling

func (*HighlightDsl) Schema Uses

func (h *HighlightDsl) Schema(schema string) *HighlightDsl

func (*HighlightDsl) SetOptions Uses

func (h *HighlightDsl) SetOptions(options *HighlightEmbed) *HighlightDsl

type HighlightEmbed Uses

type HighlightEmbed struct {
    BoundaryCharsVal   string    `json:"boundary_chars,omitempty"`
    BoundaryMaxScanVal int       `json:"boundary_max_scan,omitempty"`
    PreTags            []string  `json:"pre_tags,omitempty"`
    PostTags           []string  `json:"post_tags,omitempty"`
    FragmentSizeVal    int       `json:"fragment_size,omitempty"`
    NumOfFragmentsVal  int       `json:"number_of_fragments,omitempty"`
    HighlightQuery     *QueryDsl `json:"highlight_query,omitempty"`
    MatchedFieldsVal   []string  `json:"matched_fields,omitempty"`
    OrderVal           string    `json:"order,omitempty"`
    TypeVal            string    `json:"type,omitempty"`
}

func NewHighlightOpts Uses

func NewHighlightOpts() *HighlightEmbed

func (*HighlightEmbed) BoundaryChars Uses

func (o *HighlightEmbed) BoundaryChars(chars string) *HighlightEmbed

func (*HighlightEmbed) BoundaryMaxScan Uses

func (o *HighlightEmbed) BoundaryMaxScan(max int) *HighlightEmbed

func (*HighlightEmbed) FragSize Uses

func (he *HighlightEmbed) FragSize(size int) *HighlightEmbed

func (*HighlightEmbed) MatchedFields Uses

func (he *HighlightEmbed) MatchedFields(fields ...string) *HighlightEmbed

func (*HighlightEmbed) NumFrags Uses

func (he *HighlightEmbed) NumFrags(numFrags int) *HighlightEmbed

func (*HighlightEmbed) Order Uses

func (he *HighlightEmbed) Order(order string) *HighlightEmbed

func (*HighlightEmbed) Tags Uses

func (he *HighlightEmbed) Tags(pre string, post string) *HighlightEmbed

func (*HighlightEmbed) Type Uses

func (he *HighlightEmbed) Type(highlightType string) *HighlightEmbed

type Histogram Uses

type Histogram struct {
    Field    string  `json:"field"`
    Interval float64 `json:"interval"`
}

type Hit Uses

type Hit struct {
    Index       string           `json:"_index"`
    Type        string           `json:"_type,omitempty"`
    Id          string           `json:"_id"`
    Score       Float32Nullable  `json:"_score,omitempty"` // Filters (no query) dont have score, so is null
    Source      *json.RawMessage `json:"_source"`          // marshalling left to consumer
    TTL         *TTL             `json:"_ttl,omitempty"`
    Fields      *json.RawMessage `json:"fields"` // when a field arg is passed to ES, instead of _source it returns fields
    Explanation *Explanation     `json:"_explanation,omitempty"`
    Highlight   *Highlight       `json:"highlight,omitempty"`
    Sort        []interface{}    `json:"sort,omitempty"`
}

type Hits Uses

type Hits struct {
    Total int `json:"total"`
    //	MaxScore float32 `json:"max_score"`
    Hits []Hit `json:"hits"`
}

func (*Hits) Len Uses

func (h *Hits) Len() int

type Http Uses

type Http struct {
    BoundAddress   string `json:"bound_address,omitempty"`
    PublishAddress string `json:"publish_address,omitempty"`
}

type IdOptions Uses

type IdOptions struct {
    Index string `json:"index,omitempty"`
    Path  string `json:"path,omitempty"`
}

type IdsFilter Uses

type IdsFilter struct {
    Type   []string      `json:"type,omitempty"`
    Values []interface{} `json:"values,omitempty"`
}

IdsFilter holds the type and ids (on the _id field) to filter Type: a string or an array of string types. Optional. Values: Array of ids to match

type IndexStatus Uses

type IndexStatus struct {
    Shards Status `json:"_shards"`
}

type Interface Uses

type Interface struct {
    Address    string `json:"address,omitempty"`
    Name       string `json:"name,omitempty"`
    MacAddress string `json:"mac_address,omitempty"`
}

type JVM Uses

type JVM struct {
    Pid          int      `json:"pid,omitempty"`
    Version      string   `json:"version,omitempty"`
    VMName       string   `json:"vm_name,omitempty"`
    VMVersion    string   `json:"vm_version,omitempty"`
    VMVendor     string   `json:"vm_vendor,omitempty"`
    StartTime    int      `json:"start_time,omitempty"`
    Mem          *JvmMem  `json:"mem,omitempty"`
    GcCollectors []string `json:"gc_collectors,omitempty"`
    MemoryPools  []string `json:"memory_pools,omitempty"`
}

type JsonAlias Uses

type JsonAlias struct {
    Index string `json:"index"`
    Alias string `json:"alias"`
}

type JsonAliasAdd Uses

type JsonAliasAdd struct {
    Add JsonAlias `json:"add"`
}

type JsonAliases Uses

type JsonAliases struct {
    Actions []JsonAliasAdd `json:"actions"`
}

type JvmMem Uses

type JvmMem struct {
    HeapInitInBytes    int `json:"heap_init_in_bytes,omitempty"`
    HeapMaxInBytes     int `json:"heap_max_in_bytes,omitempty"`
    NonHeapInitInBytes int `json:"non_heap_init_in_bytes,omitempty"`
    NonHeapMaxInBytes  int `json:"non_heap_max_in_bytes,omitempty"`
    DirectMaxInBytes   int `json:"direct_max_in_bytes,omitempty"`
}

type LimitFilter Uses

type LimitFilter struct {
    Value int `json:"value"`
}

LimitFilter holds the Limit filter information Value: number of documents to limit

type MEM Uses

type MEM struct {
    TotalInBytes int `json:"total_in_bytes,omitempty"`
}

type MGetRequest Uses

type MGetRequest struct {
    Index  string   `json:"_index"`
    Type   string   `json:"_type"`
    ID     string   `json:"_id"`
    IDS    []string `json:"_ids,omitempty"`
    Fields []string `json:"fields,omitempty"`
}

type MGetRequestContainer Uses

type MGetRequestContainer struct {
    Docs []MGetRequest `json:"docs"`
}

type MGetResponseContainer Uses

type MGetResponseContainer struct {
    Docs []BaseResponse `json:"docs"`
}

type MLT Uses

type MLT struct {
    Fields              []string `json:"fields"`
    LikeText            string   `json:"like_text"`
    PercentTermsToMatch float32  `json:"percent_terms_to_match"`
    MinTermFrequency    int      `json:"min_term_freq"`
    MaxQueryTerms       int      `json:"max_query_terms"`
    StopWords           []string `json:"stop_words"`
    MinDocFrequency     int      `json:"min_doc_freq"`
    MaxDocFrequency     int      `json:"max_doc_freq"`
    MinWordLength       int      `json:"min_word_len"`
    MaxWordLength       int      `json:"max_word_len"`
    BoostTerms          int      `json:"boost_terms"`
    Boost               float32  `json:"boost"`
    Analyzer            string   `json:"analyzer"`
}

type Mapping Uses

type Mapping map[string]MappingOptions

func MappingForType Uses

func MappingForType(typeName string, opts MappingOptions) Mapping

func (Mapping) Options Uses

func (m_ Mapping) Options() MappingOptions

type MappingOptions Uses

type MappingOptions struct {
    Id               IdOptions                `json:"_id"`
    Timestamp        TimestampOptions         `json:"_timestamp"`
    Analyzer         *AnalyzerOptions         `json:"_analyzer,omitempty"`
    Parent           *ParentOptions           `json:"_parent,omitempty"`
    Routing          *RoutingOptions          `json:"_routing,omitempty"`
    Size             *SizeOptions             `json:"_size,omitempty"`
    Source           *SourceOptions           `json:"_source,omitempty"`
    TTL              *TTLOptions              `json:"_ttl,omitempty"`
    Type             *TypeOptions             `json:"_type,omitempty"`
    Properties       map[string]interface{}   `json:"properties"`
    DynamicTemplates []map[string]interface{} `json:"dynamic_templates,omitempty"`
}

type Match Uses

type Match struct {
    OK          bool         `json:"ok"`
    Matches     []MatchRes   `json:"matches"`
    Explanation *Explanation `json:"explanation,omitempty"`
}

type MatchAll Uses

type MatchAll struct {
    All string `json:"-"`
}

type MatchRes Uses

type MatchRes struct {
    Index string `json:"_index"`
    Id    string `json:"_id"`
}

type MoreLikeThisQuery Uses

type MoreLikeThisQuery struct {
    MoreLikeThis MLT `json:"more_like_this"`
}

type MoveCommand Uses

type MoveCommand struct {
    Index    string `json:"index"`
    Shard    string `json:"shard"`
    FromNode string `json:"from_node"`
    ToNode   string `json:"to_node"`
}

type MultiMatch Uses

type MultiMatch struct {
    Query  string   `json:"query"`
    Fields []string `json:"fields"`
}

type Network Uses

type Network struct {
    RefreshInterval  int        `json:"refresh_interval,omitempty"`
    PrimaryInterface *Interface `json:"primary_interface,omitempty"`
}

type Node Uses

type Node struct {
    Name             string      `json:"name,omitempty"`
    TransportAddress string      `json:"transport_address,omitempty"`
    Host             string      `json:"host,omitempty"`
    Ip               string      `json:"ip,omitempty"`
    Version          string      `json:"version,omitempty"`
    Build            string      `json:"build,omitempty"`
    Hostname         string      `json:"hostname,omitempty"`
    HttpAddress      string      `json:"http_address,omitempty"`
    Settings         *Settings   `json:"settings,omitempty"`
    OS               *OS         `json:"os,omitempty"`
    Process          *Process    `json:"process,omitempty"`
    JVM              *JVM        `json:"jvm,omitempty"`
    ThreadPool       *ThreadPool `json:"thread_pool,omitempty"`
    Network          *Network    `json:"network,omitempty"`
    Transport        *Transport  `json:"transport,omitempty"`
    Http             *Http       `json:"http,omitempty"`
    Plugins          []*Plugin   `json:"plugins,omitempty"`
}

type NodeInfo Uses

type NodeInfo struct {
    ClusterName string          `json:"cluster_name"`
    Nodes       map[string]Node `json:"nodes"` // node name is random string
}

type NodeStatsFSDataResponse Uses

type NodeStatsFSDataResponse struct {
    Path          string `json:"path"`
    Mount         string `json:"mount"`
    Device        string `json:"dev"`
    Total         int64  `json:"total_in_bytes"`
    Free          int64  `json:"free_in_bytes"`
    Available     int64  `json:"available_in_bytes"`
    DiskReads     int64  `json:"disk_reads"`
    DiskWrites    int64  `json:"disk_writes"`
    DiskReadSize  int64  `json:"disk_read_size_in_bytes"`
    DiskWriteSize int64  `json:"disk_write_size_in_bytes"`
}

type NodeStatsFSResponse Uses

type NodeStatsFSResponse struct {
    Timestamp int64                     `json:"timestamp"`
    Data      []NodeStatsFSDataResponse `json:"data"`
}

type NodeStatsFieldDataBreakerResponse Uses

type NodeStatsFieldDataBreakerResponse struct {
    MaximumSizeInBytes   int64   `json:"maximum_size_in_bytes"`
    MaximumSize          string  `json:"maximum_size"`
    EstimatedSizeInBytes int64   `json:"estimated_size_in_bytes"`
    EstimatedSize        string  `json:"estimated_size"`
    Overhead             float64 `json:"overhead"`
    Tripped              int64   `json:"tripped"`
}

type NodeStatsHTTPResponse Uses

type NodeStatsHTTPResponse struct {
    CurrentOpen int64 `json:"current_open"`
    TotalOpen   int64 `json:"total_open"`
}

type NodeStatsIndicesCompletionResponse Uses

type NodeStatsIndicesCompletionResponse struct {
    SizeInBytes int64 `json:"size_in_bytes"`
}

type NodeStatsIndicesDocsResponse Uses

type NodeStatsIndicesDocsResponse struct {
    Count   int64 `json:"count"`
    Deleted int64 `json:"deleted"`
}

type NodeStatsIndicesFieldDataResponse Uses

type NodeStatsIndicesFieldDataResponse struct {
    MemorySizeInBytes int64 `json:"memory_size_in_bytes"`
    Evictions         int64 `json:"evictions"`
}

type NodeStatsIndicesFilterCacheResponse Uses

type NodeStatsIndicesFilterCacheResponse struct {
    MemorySizeInBytes int64 `json:"memory_size_in_bytes"`
    Evictions         int64 `json:"evictions"`
}

type NodeStatsIndicesFlushResponse Uses

type NodeStatsIndicesFlushResponse struct {
    Total         int64 `json:"total"`
    TotalTimeInMs int64 `json:"total_time_in_millis"`
}

type NodeStatsIndicesGetResponse Uses

type NodeStatsIndicesGetResponse struct {
    Total        int64 `json:"total"`
    Time         int64 `json:"time_in_millis"`
    ExistsTotal  int64 `json:"exists_total"`
    ExistsTime   int64 `json:"exists_time_in_millis"`
    MissingTotal int64 `json:"missing_total"`
    MissingTime  int64 `json:"missing_time_in_millis"`
    Current      int64 `json:"current"`
}

type NodeStatsIndicesIdCacheResponse Uses

type NodeStatsIndicesIdCacheResponse struct {
    MemorySizeInBytes int64 `json:"memory_size_in_bytes"`
}

type NodeStatsIndicesIndexingResponse Uses

type NodeStatsIndicesIndexingResponse struct {
    IndexTotal    int64 `json:"index_total"`
    IndexTime     int64 `json:"index_time_in_millis"`
    IndexCurrent  int64 `json:"index_current"`
    DeleteTotal   int64 `json:"delete_total"`
    DeleteTime    int64 `json:"delete_time_in_millis"`
    DeleteCurrent int64 `json:"delete_current"`
}

type NodeStatsIndicesMergesResponse Uses

type NodeStatsIndicesMergesResponse struct {
    Current            int64 `json:"current"`
    CurrentDocs        int64 `json:"current_docs"`
    CurrentSizeInBytes int64 `json:"current_size_in_bytes"`
    Total              int64 `json:"total"`
    TotalTimeInMs      int64 `json:"total_time_in_millis"`
    TotalDocs          int64 `json:"total_docs"`
    TotalSizeInBytes   int64 `json:"total_size_in_bytes"`
}

type NodeStatsIndicesPercolateResponse Uses

type NodeStatsIndicesPercolateResponse struct {
    Total             int64  `json:"total"`
    TimeInMs          int64  `json:"time_in_millis"`
    Current           int64  `json:"current"`
    MemorySizeInBytes int64  `json:"memory_size_in_bytes"`
    MemorySize        string `json:"memory_size"`
    Queries           int64  `json:"queries"`
}

type NodeStatsIndicesRefreshResponse Uses

type NodeStatsIndicesRefreshResponse struct {
    Total         int64 `json:"total"`
    TotalTimeInMs int64 `json:"total_time_in_millis"`
}

type NodeStatsIndicesResponse Uses

type NodeStatsIndicesResponse struct {
    Docs        NodeStatsIndicesDocsResponse        `json:"docs"`
    Store       NodeStatsIndicesStoreResponse       `json:"store"`
    Indexing    NodeStatsIndicesIndexingResponse    `json:"indexing"`
    Get         NodeStatsIndicesGetResponse         `json:"get"`
    Search      NodeStatsIndicesSearchResponse      `json:"search"`
    Merges      NodeStatsIndicesMergesResponse      `json:"merges"`
    Refresh     NodeStatsIndicesRefreshResponse     `json:"refresh"`
    Flush       NodeStatsIndicesFlushResponse       `json:"flush"`
    Warmer      NodeStatsIndicesWarmerResponse      `json:"warmer"`
    FilterCache NodeStatsIndicesFilterCacheResponse `json:"filter_cache"`
    IdCache     NodeStatsIndicesIdCacheResponse     `json:"id_cache"`
    FieldData   NodeStatsIndicesFieldDataResponse   `json:"fielddata"`
    Percolate   NodeStatsIndicesPercolateResponse   `json:"percolate"`
    Completion  NodeStatsIndicesCompletionResponse  `json:"completion"`
    Segments    NodeStatsIndicesSegmentsResponse    `json:"segments"`
    Translog    NodeStatsIndicesTranslogResponse    `json:"translog"`
    Suggest     NodeStatsIndicesSuggestResponse     `json:"suggest"`
}

type NodeStatsIndicesSearchResponse Uses

type NodeStatsIndicesSearchResponse struct {
    OpenContext  int64 `json:"open_contexts"`
    QueryTotal   int64 `json:"query_total"`
    QueryTime    int64 `json:"query_time_in_millis"`
    QueryCurrent int64 `json:"query_current"`
    FetchTotal   int64 `json:"fetch_total"`
    FetchTime    int64 `json:"fetch_time_in_millis"`
    FetchCurrent int64 `json:"fetch_current"`
}

type NodeStatsIndicesSegmentsResponse Uses

type NodeStatsIndicesSegmentsResponse struct {
    Count                    int64 `json:"count"`
    MemoryInBytes            int64 `json:"memory_in_bytes"`
    IndexWriterMemoryInBytes int64 `json:"index_writer_memory_in_bytes"`
    VersionMapMemoryInBytes  int64 `json:"version_map_memory_in_bytes"`
}

type NodeStatsIndicesStoreResponse Uses

type NodeStatsIndicesStoreResponse struct {
    Size         int64 `json:"size_in_bytes"`
    ThrottleTime int64 `json:"throttle_time_in_millis"`
}

type NodeStatsIndicesSuggestResponse Uses

type NodeStatsIndicesSuggestResponse struct {
    Total    int64 `json:"total"`
    TimeInMs int64 `json:"time_in_millis"`
    Current  int64 `json:"current"`
}

type NodeStatsIndicesTranslogResponse Uses

type NodeStatsIndicesTranslogResponse struct {
    Operations  int64 `json:"operations"`
    SizeInBytes int64 `json:"size_in_bytes"`
}

type NodeStatsIndicesWarmerResponse Uses

type NodeStatsIndicesWarmerResponse struct {
    Current       int64 `json:"current"`
    Total         int64 `json:"total"`
    TotalTimeInMs int64 `json:"total_time_in_millis"`
}

type NodeStatsJVMBufferPoolsResponse Uses

type NodeStatsJVMBufferPoolsResponse struct {
    Count                int64 `json:"count"`
    UsedInBytes          int64 `json:"used_in_bytes"`
    TotalCapacityInBytes int64 `json:"total_capacity_in_bytes"`
}

type NodeStatsJVMGCCollectorsAgeResponse Uses

type NodeStatsJVMGCCollectorsAgeResponse struct {
    Count    int64 `json:"collection_count"`
    TimeInMs int64 `json:"collection_time_in_millis"`
}

type NodeStatsJVMGCResponse Uses

type NodeStatsJVMGCResponse struct {
    Collectors map[string]NodeStatsJVMGCCollectorsAgeResponse `json:"collectors"`
}

type NodeStatsJVMMemPoolsResponse Uses

type NodeStatsJVMMemPoolsResponse struct {
    UsedInBytes     int64 `json:"used_in_bytes"`
    MaxInBytes      int64 `json:"max_in_bytes"`
    PeakUsedInBytes int64 `json:"peak_used_in_bytes"`
    PeakMaxInBytes  int64 `json:"peak_max_in_bytes"`
}

type NodeStatsJVMMemResponse Uses

type NodeStatsJVMMemResponse struct {
    HeapUsedInBytes         int64                                   `json:"heap_used_in_bytes"`
    HeapUsedPercent         int64                                   `json:"heap_used_percent"`
    HeapCommitedInBytes     int64                                   `json:"heap_commited_in_bytes"`
    HeapMaxInBytes          int64                                   `json:"heap_max_in_bytes"`
    NonHeapUsedInBytes      int64                                   `json:"non_heap_used_in_bytes"`
    NonHeapCommittedInBytes int64                                   `json:"non_heap_committed_in_bytes"`
    Pools                   map[string]NodeStatsJVMMemPoolsResponse `json:"pools"`
}

type NodeStatsJVMResponse Uses

type NodeStatsJVMResponse struct {
    Timestame   int64                                      `json:"timestamp"`
    UptimeInMs  int64                                      `json:"uptime_in_millis"`
    Mem         NodeStatsJVMMemResponse                    `json:"mem"`
    Threads     NodeStatsJVMThreadsResponse                `json:"threads"`
    GC          NodeStatsJVMGCResponse                     `json:"gc"`
    BufferPools map[string]NodeStatsJVMBufferPoolsResponse `json:"buffer_pools"`
}

type NodeStatsJVMThreadsResponse Uses

type NodeStatsJVMThreadsResponse struct {
    Count     int64 `json:"count"`
    PeakCount int64 `json:"peak_count"`
}

type NodeStatsNetworkResponse Uses

type NodeStatsNetworkResponse struct {
    TCP NodeStatsTCPResponse `json:"tcp"`
}

type NodeStatsNodeAttributes Uses

type NodeStatsNodeAttributes struct {
    Data   string `json:"data"`
    Client string `json:"client"`
}

type NodeStatsNodeResponse Uses

type NodeStatsNodeResponse struct {
    Name             string                                     `json:"name"`
    Timestamp        int64                                      `json:"timestamp"`
    TransportAddress string                                     `json:"transport_address"`
    Hostname         string                                     `json:"hostname"`
    Host             string                                     `json:"host"`
    IP               []string                                   `json:"ip"`
    Attributes       NodeStatsNodeAttributes                    `json:"attributes"`
    Indices          NodeStatsIndicesResponse                   `json:"indices"`
    OS               NodeStatsOSResponse                        `json:"os"`
    Process          NodeStatsProcessResponse                   `json:"process"`
    JVM              NodeStatsJVMResponse                       `json:"jvm"`
    Network          NodeStatsNetworkResponse                   `json:"network"`
    FS               NodeStatsFSResponse                        `json:"fs"`
    ThreadPool       map[string]NodeStatsThreadPoolPoolResponse `json:"thread_pool"`
    Transport        NodeStatsTransportResponse                 `json:"transport"`
    FieldDataBreaker NodeStatsFieldDataBreakerResponse          `json:"fielddata_breaker"`
}

type NodeStatsOSCPUResponse Uses

type NodeStatsOSCPUResponse struct {
    Sys   int64 `json:"sys"`
    User  int64 `json:"user"`
    Idle  int64 `json:"idle"`
    Steal int64 `json:"stolen"`
}

type NodeStatsOSMemResponse Uses

type NodeStatsOSMemResponse struct {
    Free       int64 `json:"free_in_bytes"`
    Used       int64 `json:"used_in_bytes"`
    ActualFree int64 `json:"actual_free_in_bytes"`
    ActualUsed int64 `json:"actual_used_in_bytes"`
}

type NodeStatsOSResponse Uses

type NodeStatsOSResponse struct {
    Timestamp int64                   `json:"timestamp"`
    Uptime    int64                   `json:"uptime_in_millis"`
    LoadAvg   []float64               `json:"load_average"`
    CPU       NodeStatsOSCPUResponse  `json:"cpu"`
    Mem       NodeStatsOSMemResponse  `json:"mem"`
    Swap      NodeStatsOSSwapResponse `json:"swap"`
}

type NodeStatsOSSwapResponse Uses

type NodeStatsOSSwapResponse struct {
    Used int64 `json:"used_in_bytes"`
    Free int64 `json:"free_in_bytes"`
}

type NodeStatsProcessCPUResponse Uses

type NodeStatsProcessCPUResponse struct {
    Percent int64 `json:"percent"`
    Sys     int64 `json:"sys_in_millis"`
    User    int64 `json:"user_in_millis"`
    Total   int64 `json:"total_in_millis"`
}

type NodeStatsProcessMemResponse Uses

type NodeStatsProcessMemResponse struct {
    Resident     int64 `json:"resident_in_bytes"`
    Share        int64 `json:"share_in_bytes"`
    TotalVirtual int64 `json:"total_virtual_in_bytes"`
}

type NodeStatsProcessResponse Uses

type NodeStatsProcessResponse struct {
    Timestamp int64                       `json:"timestamp"`
    OpenFD    int64                       `json:"open_file_descriptors"`
    CPU       NodeStatsProcessCPUResponse `json:"cpu"`
    Memory    NodeStatsProcessMemResponse `json:"mem"`
}

type NodeStatsResponse Uses

type NodeStatsResponse struct {
    ClusterName string `json:"cluster_name"`
    Nodes       map[string]NodeStatsNodeResponse
}

type NodeStatsTCPResponse Uses

type NodeStatsTCPResponse struct {
    ActiveOpens  int64 `json:"active_opens"`
    PassiveOpens int64 `json:"passive_opens"`
    CurrEstab    int64 `json:"curr_estab"`
    InSegs       int64 `json:"in_segs"`
    OutSegs      int64 `json:"out_segs"`
    RetransSegs  int64 `json:"retrans_segs"`
    EstabResets  int64 `json:"estab_resets"`
    AttemptFails int64 `json:"attempt_fails"`
    InErrs       int64 `json:"in_errs"`
    OutRsts      int64 `json:"out_rsts"`
}

type NodeStatsThreadPoolPoolResponse Uses

type NodeStatsThreadPoolPoolResponse struct {
    Threads   int64 `json:"threads"`
    Queue     int64 `json:"queue"`
    Active    int64 `json:"active"`
    Rejected  int64 `json:"rejected"`
    Largest   int64 `json:"largest"`
    Completed int64 `json:"completed"`
}

type NodeStatsTransportResponse Uses

type NodeStatsTransportResponse struct {
    ServerOpen int64 `json:"server_open"`
    RxCount    int64 `json:"rx_count"`
    RxSize     int64 `json:"rx_size_in_bytes"`
    TxCount    int64 `json:"tx_count"`
    TxSize     int64 `json:"tx_size_in_bytes"`
}

type OS Uses

type OS struct {
    RefreshInterval     int  `json:"refresh_interval,omitempty"`
    AvailableProcessors int  `json:"available_processors,omitempty"`
    CPU                 *CPU `json:"cpu,omitempty"`
}

type OneTermQuery Uses

type OneTermQuery struct {
    Query struct {
        Term string `json:"term"`
    } `json:"query"`
}

type ParentOptions Uses

type ParentOptions struct {
    Type string `json:"type"`
}

type Path Uses

type Path struct {
    Logs string `json:"logs,omitempty"`
    // contains filtered or unexported fields
}

type PercolatorMatch Uses

type PercolatorMatch struct {
    Index string `json:"_index"`
    Id    string `json:"_id"`
}

type PercolatorResult Uses

type PercolatorResult struct {
    SearchResult
    Matches []PercolatorMatch `json:"matches"`
}

type Plugin Uses

type Plugin struct {
    Name        string `json:"name,omitempty"`
    Description string `json:"description,omitempty"`
    Site        bool   `json:"site,omitempty"`
    Jvm         bool   `json:"jvm,omitempty"`
    Url         string `json:"url,omitempty"`
}

type Process Uses

type Process struct {
    RefreshInterval    int  `json:"refresh_interval,omitempty"`
    Id                 int  `json:"id,omitempty"`
    MaxFileDescriptors int  `json:"max_file_descriptors,omitempty"`
    Mlockall           bool `json:"mlockall,omitempty"`
}

type QueryDsl Uses

type QueryDsl struct {
    QueryEmbed
    FilterVal *FilterOp `json:"filter,omitempty"`
}

some ways to serialize "query": {

"filtered": {
  "query": {
    "query_string": {
      "default_operator": "OR",
      "default_field": "_all",
      "query": " actor:\"bob\"  AND type:\"EventType\""
    }
  },
  "filter": {
    "range": {
      "@timestamp": {
        "from": "2012-12-29T16:52:48+00:00",
        "to": "2012-12-29T17:52:48+00:00"
      }
    }
  }
}

},

"query" : {

"term" : { "user" : "kimchy" }

}

"query" : {

"match_all" : {}

},

func Query Uses

func Query() *QueryDsl

Query creates a new Query Dsl

func (*QueryDsl) All Uses

func (q *QueryDsl) All() *QueryDsl

get all

func (*QueryDsl) Fields Uses

func (q *QueryDsl) Fields(fields, search, exists, missing string) *QueryDsl

Fields in query_string search

Fields("fieldname","search_for","","")

Fields("fieldname,field2,field3","search_for","","")

Fields("fieldname,field2,field3","search_for","field_exists","")

func (*QueryDsl) Filter Uses

func (q *QueryDsl) Filter(f *FilterOp) *QueryDsl

Filter this query

func (*QueryDsl) FunctionScore Uses

func (q *QueryDsl) FunctionScore(mode string, functions ...map[string]interface{}) *QueryDsl

FunctionScore sets functions to use to score the documents. http://www.elastic.co/guide/en/elasticsearch/reference/1.x/query-dsl-function-score-query.html

func (*QueryDsl) MarshalJSON Uses

func (qd *QueryDsl) MarshalJSON() ([]byte, error)

MarshalJSON provides custom marshalling to support the query dsl which is a conditional json format, not always the same parent/children

func (*QueryDsl) MultiMatch Uses

func (q *QueryDsl) MultiMatch(s string, fields []string) *QueryDsl

MultiMatch allows searching against multiple fields.

func (*QueryDsl) Qs Uses

func (q *QueryDsl) Qs(qs *QueryString) *QueryDsl

Querystring operations

func (*QueryDsl) Range Uses

func (q *QueryDsl) Range(fop *FilterOp) *QueryDsl

Range adds a RANGE FilterOp to the search query Legacy. Use the Filter() function instead

func (*QueryDsl) Search Uses

func (q *QueryDsl) Search(searchFor string) *QueryDsl

The raw search strings (lucene valid)

func (*QueryDsl) SetLenient Uses

func (q *QueryDsl) SetLenient(lenient bool) *QueryDsl

SetLenient sets whether the query should ignore format based failures, such as passing in text to a number field.

func (*QueryDsl) Term Uses

func (q *QueryDsl) Term(name, value string) *QueryDsl

Add a term search for a specific field

Term("user","kimchy")

type QueryEmbed Uses

type QueryEmbed struct {
    MatchAll      *MatchAll              `json:"match_all,omitempty"`
    Terms         map[string]string      `json:"term,omitempty"`
    Qs            *QueryString           `json:"query_string,omitempty"`
    MultiMatch    *MultiMatch            `json:"multi_match,omitempty"`
    FunctionScore map[string]interface{} `json:"function_score,omitempty"`
}

The core Query Syntax can be embedded as a child of a variety of different parents

type QueryString Uses

type QueryString struct {
    DefaultOperator string   `json:"default_operator,omitempty"`
    DefaultField    string   `json:"default_field,omitempty"`
    Query           string   `json:"query,omitempty"`
    Exists          string   `json:"_exists_,omitempty"`
    Missing         string   `json:"_missing_,omitempty"`
    Fields          []string `json:"fields,omitempty"`
    Lenient         bool     `json:"lenient,omitempty"`
}

func NewQueryString Uses

func NewQueryString(field, query string) QueryString

QueryString based search

type QueryWrap Uses

type QueryWrap struct {
    Qs QueryString `json:"query_string,omitempty"`
}

should we reuse QueryDsl here?

type RangeDef Uses

type RangeDef struct {
    Field  string      `json:"field,omitempty"`
    Values []*RangeVal `json:"ranges,omitempty"`
}

type RangeDsl Uses

type RangeDsl struct {
    RangeDef  *RangeDef   `json:"range,omitempty"`
    FilterVal *FilterWrap `json:"facet_filter,omitempty"`
}

func FacetRange Uses

func FacetRange(field string) *RangeDsl

func (*RangeDsl) Filter Uses

func (s *RangeDsl) Filter(fl ...interface{}) *RangeDsl

func (*RangeDsl) Range Uses

func (m *RangeDsl) Range(from, to string) *RangeDsl

type RangeFilter Uses

type RangeFilter struct {
    Gte      interface{} `json:"gte,omitempty"`
    Lte      interface{} `json:"lte,omitempty"`
    Gt       interface{} `json:"gt,omitempty"`
    Lt       interface{} `json:"lt,omitempty"`
    TimeZone string      `json:"time_zone,omitempty"` //Ideally this would be an int
}

RangeFilter filters given a range. Parameters need to be comparable for ES to accept. Only a minimum of one comparison parameter is required. You probably shouldn't mix GT and GTE parameters. Gte: the greater-than-or-equal to value. Should be a number or date. Lte: the less-than-or-equal to value. Should be a number or date. Gt: the greater-than value. Should be a number or date. Lt: the less-than value. Should be a number or date. TimeZone: the timezone to use (+|-h:mm format), if the other parameters are dates

type RangeVal Uses

type RangeVal struct {
    From string `json:"from,omitempty"`
    To   string `json:"to,omitempty"`
}

type Request Uses

type Request struct {
    *http.Client
    *http.Request
    // contains filtered or unexported fields
}

func (*Request) Do Uses

func (r *Request) Do(v interface{}) (int, []byte, error)

func (*Request) DoResponse Uses

func (r *Request) DoResponse(v interface{}) (*http.Response, []byte, error)

func (*Request) SetBody Uses

func (r *Request) SetBody(body io.Reader)

func (*Request) SetBodyBytes Uses

func (r *Request) SetBodyBytes(body []byte)

func (*Request) SetBodyGzip Uses

func (r *Request) SetBodyGzip(data interface{}) error

func (*Request) SetBodyJson Uses

func (r *Request) SetBodyJson(data interface{}) error

func (*Request) SetBodyString Uses

func (r *Request) SetBodyString(body string)

type RoutingOptions Uses

type RoutingOptions struct {
    Required bool   `json:"required,omitempty"`
    Path     string `json:"path,omitempty"`
}

type SWAP Uses

type SWAP struct {
    TotalInBytes int `json:"total_in_bytes,omitempty"`
}

type ScriptFilter Uses

type ScriptFilter struct {
    Script   string                 `json:"script"`
    Params   map[string]interface{} `json:"params,omitempty"`
    IsCached bool                   `json:"_cache,omitempty"`
}

ScriptFilter will filter using a custom javascript function Script: the javascript to run Params: map of custom parameters to pass into the function (JSON), if any IsCached: whether to cache the results of the filter

type SearchDsl Uses

type SearchDsl struct {
    FromVal       int                      `json:"from,omitempty"`
    SizeVal       int                      `json:"size,omitempty"`
    Index         string                   `json:"-"`
    FacetVal      *FacetDsl                `json:"facets,omitempty"`
    QueryVal      *QueryDsl                `json:"query,omitempty"`
    SortBody      []*SortDsl               `json:"sort,omitempty"`
    FilterVal     *FilterOp                `json:"filter,omitempty"`
    AggregatesVal map[string]*AggregateDsl `json:"aggregations,omitempty"`
    HighlightVal  *HighlightDsl            `json:"highlight,omitempty"`
    // contains filtered or unexported fields
}
func Search(index string) *SearchDsl

Search is the entry point to the SearchDsl, it is a chainable set of utilities to create searches.

params

@index = elasticsearch index to search

out, err := Search("github").Type("Issues").Pretty().Query(
Query().Range(
     Range().Field("created_at").From("2012-12-10T15:00:00-08:00").To("2012-12-10T15:10:00-08:00"),
   ).Search("add"),
 ).Result()

func (*SearchDsl) Aggregates Uses

func (s *SearchDsl) Aggregates(aggs ...*AggregateDsl) *SearchDsl

func (*SearchDsl) Bytes Uses

func (s *SearchDsl) Bytes(conn *Conn) ([]byte, error)

func (*SearchDsl) Facet Uses

func (s *SearchDsl) Facet(f *FacetDsl) *SearchDsl

Facet passes a Query expression to this search

qry := Search("github").Size("0").Facet(
			Facet().Regex("repository.name", "no.*").Size("8"),
		)

qry := Search("github").Pretty().Facet(
			Facet().Fields("type").Size("25"),
		)

func (*SearchDsl) Fields Uses

func (s *SearchDsl) Fields(fields ...string) *SearchDsl

func (*SearchDsl) Filter Uses

func (s *SearchDsl) Filter(fl *FilterOp) *SearchDsl

func (*SearchDsl) From Uses

func (s *SearchDsl) From(from string) *SearchDsl

func (*SearchDsl) Highlight Uses

func (s *SearchDsl) Highlight(highlight *HighlightDsl) *SearchDsl

func (*SearchDsl) Pretty Uses

func (s *SearchDsl) Pretty() *SearchDsl

func (*SearchDsl) Query Uses

func (s *SearchDsl) Query(q *QueryDsl) *SearchDsl

func (*SearchDsl) Result Uses

func (s *SearchDsl) Result(conn *Conn) (*SearchResult, error)

func (*SearchDsl) Scroll Uses

func (s *SearchDsl) Scroll(duration string) *SearchDsl

func (*SearchDsl) Search Uses

func (s *SearchDsl) Search(srch string) *SearchDsl

Search is a simple interface to search, doesn't have the power of query but uses a simple query_string search

func (*SearchDsl) SearchType Uses

func (s *SearchDsl) SearchType(searchType string) *SearchDsl

func (*SearchDsl) Size Uses

func (s *SearchDsl) Size(size string) *SearchDsl

func (*SearchDsl) Sort Uses

func (s *SearchDsl) Sort(sort ...*SortDsl) *SearchDsl

func (*SearchDsl) Source Uses

func (s *SearchDsl) Source(returnSource bool) *SearchDsl

func (*SearchDsl) SourceFields Uses

func (s *SearchDsl) SourceFields(fields ...string) *SearchDsl

func (*SearchDsl) Type Uses

func (s *SearchDsl) Type(indexType string) *SearchDsl

Type is the elasticsearch *Type* within a specific index

type SearchRequest Uses

type SearchRequest struct {
    From  int          `json:"from,omitempty"`
    Size  int          `json:"size,omitempty"`
    Query OneTermQuery `json:"query,omitempty"`

    Filter struct {
        Term Term `json:"term"`
    }   `json:"filter,omitempty"`
}

type SearchResult Uses

type SearchResult struct {
    RawJSON      []byte
    Took         int             `json:"took"`
    TimedOut     bool            `json:"timed_out"`
    ShardStatus  Status          `json:"_shards"`
    Hits         Hits            `json:"hits"`
    Facets       json.RawMessage `json:"facets,omitempty"` // structure varies on query
    ScrollId     string          `json:"_scroll_id,omitempty"`
    Aggregations json.RawMessage `json:"aggregations,omitempty"` // structure varies on query
    Suggestions  Suggestions     `json:"suggest,omitempty"`
}

func (*SearchResult) String Uses

func (s *SearchResult) String() string

type Settings Uses

type Settings struct {
    Path       *Path  `json:"path,omitempty"`
    Foreground string `json:"foreground,omitempty"`
    Name       string `json:"name,omitempty"`
}

type SizeOptions Uses

type SizeOptions struct {
    Enabled bool `json:"enabled,omitempty"`
    Store   bool `json:"store,omitempty"`
}

type SortBody Uses

type SortBody []interface{}

type SortDsl Uses

type SortDsl struct {
    Name        string
    IsDesc      bool
    GeoDistance interface{}
}

func GeoDistanceSort Uses

func GeoDistanceSort(field interface{}) *SortDsl

func Sort Uses

func Sort(field string) *SortDsl

SortDsl accepts any number of Sort commands

Query().Sort(
    Sort("last_name").Desc(),
    Sort("age"),
)

func (*SortDsl) Asc Uses

func (s *SortDsl) Asc() *SortDsl

func (*SortDsl) Desc Uses

func (s *SortDsl) Desc() *SortDsl

func (*SortDsl) MarshalJSON Uses

func (s *SortDsl) MarshalJSON() ([]byte, error)

type SourceOptions Uses

type SourceOptions struct {
    Enabled  bool     `json:"enabled,omitempty"`
    Includes []string `json:"includes,omitempty"`
    Excludes []string `json:"excludes,omitempty"`
}

type Status Uses

type Status struct {
    Total      StatusInt `json:"total"`
    Successful StatusInt `json:"successful"`
    Failed     StatusInt `json:"failed"`
    Failures   []Failure `json:"failures,omitempty"`
}

type StatusBool Uses

type StatusBool bool

StatusBool is required because /_optimize, at least, returns its status as strings instead of booleans.

func (*StatusBool) MarshalJSON Uses

func (self *StatusBool) MarshalJSON() ([]byte, error)

func (*StatusBool) UnmarshalJSON Uses

func (self *StatusBool) UnmarshalJSON(b []byte) error

type StatusInt Uses

type StatusInt int

StatusInt is required because /_optimize, at least, returns its status as strings instead of integers.

func (*StatusInt) MarshalJSON Uses

func (self *StatusInt) MarshalJSON() ([]byte, error)

func (*StatusInt) UnmarshalJSON Uses

func (self *StatusInt) UnmarshalJSON(b []byte) error

type SuggestResults Uses

type SuggestResults struct {
    ShardStatus Status
    // contains filtered or unexported fields
}

func (SuggestResults) Result Uses

func (s SuggestResults) Result(suggestName string) ([]Suggestion, error)

type Suggestion Uses

type Suggestion struct {
    Length  int                `json:"length"`
    Offset  int                `json:"offset"`
    Options []SuggestionOption `json:"options"`
    Text    string             `json:"text"`
}

type SuggestionOption Uses

type SuggestionOption struct {
    Payload json.RawMessage `json:"payload"`
    Score   Float32Nullable `json:"score,omitempty"`
    Text    string          `json:"text"`
}

type Suggestions Uses

type Suggestions map[string][]Suggestion

type TTL Uses

type TTL struct{ time.Time }

TTL is a wrapper around time.Time that converts a number of milliseconds in the future to a time.Time.

func (*TTL) UnmarshalJSON Uses

func (t *TTL) UnmarshalJSON(data []byte) (err error)

type TTLOptions Uses

type TTLOptions struct {
    Enabled bool   `json:"enabled"`
    Default string `json:"default,omitempty"`
}

type Term Uses

type Term struct {
    Terms     Terms       `json:"terms,omitempty"`
    FilterVal *FilterWrap `json:"facet_filter,omitempty"`
}

Generic Term based (used in query, facet, filter)

func NewTerm Uses

func NewTerm(fields ...string) *Term

func (*Term) Filter Uses

func (s *Term) Filter(fl ...interface{}) *Term

type TermExecutionMode Uses

type TermExecutionMode string

TermExecutionMode refers to how a terms (not term) filter should behave The acceptable options are all prefixed with TEM See https://www.elastic.co/guide/en/elasticsearch/reference/1.5/query-dsl-terms-filter.html

const (
    // TEMDefault default ES term filter behavior (plain)
    TEMDefault TermExecutionMode = ""
    // TEMPlain default ES term filter behavior
    TEMPlain TermExecutionMode = "plain"
    // TEMField field_data execution mode
    TEMField TermExecutionMode = "field_data"
    // TEMBool bool execution mode
    TEMBool TermExecutionMode = "bool"
    // TEMAnd and execution mode
    TEMAnd TermExecutionMode = "and"
    // TEMOr or execution mode
    TEMOr TermExecutionMode = "or"
)

type Terms Uses

type Terms struct {
    Fields []string `json:"field,omitempty"`
    Size   string   `json:"size,omitempty"`
    Regex  string   `json:"regex,omitempty"`
}

func (*Terms) MarshalJSON Uses

func (t *Terms) MarshalJSON() ([]byte, error)

Custom marshalling

type ThreadPool Uses

type ThreadPool struct {
    Generic    *ThreadPoolConfig `json:"generic,omitempty"`
    Index      *ThreadPoolConfig `json:"index,omitempty"`
    Get        *ThreadPoolConfig `json:"get,omitempty"`
    Snapshot   *ThreadPoolConfig `json:"snapshot,omitempty"`
    Merge      *ThreadPoolConfig `json:"merge,omitempty"`
    Suggest    *ThreadPoolConfig `json:"suggest,omitempty"`
    Bulk       *ThreadPoolConfig `json:"bulk,omitempty"`
    Optimize   *ThreadPoolConfig `json:"optimize,omitempty"`
    Warmer     *ThreadPoolConfig `json:"warmer,omitempty"`
    Flush      *ThreadPoolConfig `json:"flush,omitempty"`
    Search     *ThreadPoolConfig `json:"search,omitempty"`
    Percolate  *ThreadPoolConfig `json:"percolate,omitempty"`
    Management *ThreadPoolConfig `json:"management,omitempty"`
    Refresh    *ThreadPoolConfig `json:"refresh,omitempty"`
}

type ThreadPoolConfig Uses

type ThreadPoolConfig struct {
    Type      string      `json:"type,omitempty"`
    Min       int         `json:"min,omitempty"`
    Max       int         `json:"max,omitempty"`
    QueueSize interface{} `json:"queue_size,omitempty"` // Either string or -1
    KeepAlive string      `json:"keep_alive,omitempty"`
}

type TimestampOptions Uses

type TimestampOptions struct {
    Enabled bool `json:"enabled"`
}

type Token Uses

type Token struct {
    Name        string `json:"token"`
    StartOffset int    `json:"start_offset"`
    EndOffset   int    `json:"end_offset"`
    Type        string `json:"type"`
    Position    int    `json:"position"`
}

type Transport Uses

type Transport struct {
    BoundAddress   string `json:"bound_address,omitempty"`
    PublishAddress string `json:"publish_address,omitempty"`
}

type TypeFilter Uses

type TypeFilter struct {
    Value string `json:"value"`
}

TypeFilter filters on the document type Value: the document type to filter

type TypeOptions Uses

type TypeOptions struct {
    Store bool   `json:"store,omitempty"`
    Index string `json:"index,omitempty"`
}

type Validation Uses

type Validation struct {
    Valid         bool           `json:"valid"`
    Shards        Status         `json:"_shards"`
    Explainations []Explaination `json:"explanations,omitempty"`
}

Package elastigo imports 20 packages (graph) and is imported by 242 packages. Updated 2017-07-22. Refresh now. Tools for package owners.