repo
stringlengths 5
54
| path
stringlengths 4
155
| func_name
stringlengths 1
118
| original_string
stringlengths 52
85.5k
| language
stringclasses 1
value | code
stringlengths 52
85.5k
| code_tokens
sequence | docstring
stringlengths 6
2.61k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 85
252
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
olivere/elastic | search.go | RequestCache | func (s *SearchService) RequestCache(requestCache bool) *SearchService {
s.requestCache = &requestCache
return s
} | go | func (s *SearchService) RequestCache(requestCache bool) *SearchService {
s.requestCache = &requestCache
return s
} | [
"func",
"(",
"s",
"*",
"SearchService",
")",
"RequestCache",
"(",
"requestCache",
"bool",
")",
"*",
"SearchService",
"{",
"s",
".",
"requestCache",
"=",
"&",
"requestCache",
"\n",
"return",
"s",
"\n",
"}"
] | // RequestCache indicates whether the cache should be used for this
// request or not, defaults to index level setting. | [
"RequestCache",
"indicates",
"whether",
"the",
"cache",
"should",
"be",
"used",
"for",
"this",
"request",
"or",
"not",
"defaults",
"to",
"index",
"level",
"setting",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search.go#L152-L155 | train |
olivere/elastic | search.go | DocvalueField | func (s *SearchService) DocvalueField(docvalueField string) *SearchService {
s.searchSource = s.searchSource.DocvalueField(docvalueField)
return s
} | go | func (s *SearchService) DocvalueField(docvalueField string) *SearchService {
s.searchSource = s.searchSource.DocvalueField(docvalueField)
return s
} | [
"func",
"(",
"s",
"*",
"SearchService",
")",
"DocvalueField",
"(",
"docvalueField",
"string",
")",
"*",
"SearchService",
"{",
"s",
".",
"searchSource",
"=",
"s",
".",
"searchSource",
".",
"DocvalueField",
"(",
"docvalueField",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // DocvalueField adds a single field to load from the field data cache
// and return as part of the search. | [
"DocvalueField",
"adds",
"a",
"single",
"field",
"to",
"load",
"from",
"the",
"field",
"data",
"cache",
"and",
"return",
"as",
"part",
"of",
"the",
"search",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search.go#L261-L264 | train |
olivere/elastic | search.go | DocvalueFieldWithFormat | func (s *SearchService) DocvalueFieldWithFormat(docvalueField DocvalueField) *SearchService {
s.searchSource = s.searchSource.DocvalueFieldWithFormat(docvalueField)
return s
} | go | func (s *SearchService) DocvalueFieldWithFormat(docvalueField DocvalueField) *SearchService {
s.searchSource = s.searchSource.DocvalueFieldWithFormat(docvalueField)
return s
} | [
"func",
"(",
"s",
"*",
"SearchService",
")",
"DocvalueFieldWithFormat",
"(",
"docvalueField",
"DocvalueField",
")",
"*",
"SearchService",
"{",
"s",
".",
"searchSource",
"=",
"s",
".",
"searchSource",
".",
"DocvalueFieldWithFormat",
"(",
"docvalueField",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // DocvalueFieldWithFormat adds a single field to load from the field data cache
// and return as part of the search. | [
"DocvalueFieldWithFormat",
"adds",
"a",
"single",
"field",
"to",
"load",
"from",
"the",
"field",
"data",
"cache",
"and",
"return",
"as",
"part",
"of",
"the",
"search",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search.go#L268-L271 | train |
olivere/elastic | search.go | DocvalueFields | func (s *SearchService) DocvalueFields(docvalueFields ...string) *SearchService {
s.searchSource = s.searchSource.DocvalueFields(docvalueFields...)
return s
} | go | func (s *SearchService) DocvalueFields(docvalueFields ...string) *SearchService {
s.searchSource = s.searchSource.DocvalueFields(docvalueFields...)
return s
} | [
"func",
"(",
"s",
"*",
"SearchService",
")",
"DocvalueFields",
"(",
"docvalueFields",
"...",
"string",
")",
"*",
"SearchService",
"{",
"s",
".",
"searchSource",
"=",
"s",
".",
"searchSource",
".",
"DocvalueFields",
"(",
"docvalueFields",
"...",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // DocvalueFields adds one or more fields to load from the field data cache
// and return as part of the search. | [
"DocvalueFields",
"adds",
"one",
"or",
"more",
"fields",
"to",
"load",
"from",
"the",
"field",
"data",
"cache",
"and",
"return",
"as",
"part",
"of",
"the",
"search",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search.go#L275-L278 | train |
olivere/elastic | search.go | DocvalueFieldsWithFormat | func (s *SearchService) DocvalueFieldsWithFormat(docvalueFields ...DocvalueField) *SearchService {
s.searchSource = s.searchSource.DocvalueFieldsWithFormat(docvalueFields...)
return s
} | go | func (s *SearchService) DocvalueFieldsWithFormat(docvalueFields ...DocvalueField) *SearchService {
s.searchSource = s.searchSource.DocvalueFieldsWithFormat(docvalueFields...)
return s
} | [
"func",
"(",
"s",
"*",
"SearchService",
")",
"DocvalueFieldsWithFormat",
"(",
"docvalueFields",
"...",
"DocvalueField",
")",
"*",
"SearchService",
"{",
"s",
".",
"searchSource",
"=",
"s",
".",
"searchSource",
".",
"DocvalueFieldsWithFormat",
"(",
"docvalueFields",
"...",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // DocvalueFieldsWithFormat adds one or more fields to load from the field data cache
// and return as part of the search. | [
"DocvalueFieldsWithFormat",
"adds",
"one",
"or",
"more",
"fields",
"to",
"load",
"from",
"the",
"field",
"data",
"cache",
"and",
"return",
"as",
"part",
"of",
"the",
"search",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search.go#L282-L285 | train |
olivere/elastic | search.go | NoStoredFields | func (s *SearchService) NoStoredFields() *SearchService {
s.searchSource = s.searchSource.NoStoredFields()
return s
} | go | func (s *SearchService) NoStoredFields() *SearchService {
s.searchSource = s.searchSource.NoStoredFields()
return s
} | [
"func",
"(",
"s",
"*",
"SearchService",
")",
"NoStoredFields",
"(",
")",
"*",
"SearchService",
"{",
"s",
".",
"searchSource",
"=",
"s",
".",
"searchSource",
".",
"NoStoredFields",
"(",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // NoStoredFields indicates that no stored fields should be loaded, resulting in only
// id and type to be returned per field. | [
"NoStoredFields",
"indicates",
"that",
"no",
"stored",
"fields",
"should",
"be",
"loaded",
"resulting",
"in",
"only",
"id",
"and",
"type",
"to",
"be",
"returned",
"per",
"field",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search.go#L289-L292 | train |
olivere/elastic | search.go | TotalHits | func (r *SearchResult) TotalHits() int64 {
if r.Hits != nil && r.Hits.TotalHits != nil {
return r.Hits.TotalHits.Value
}
return 0
} | go | func (r *SearchResult) TotalHits() int64 {
if r.Hits != nil && r.Hits.TotalHits != nil {
return r.Hits.TotalHits.Value
}
return 0
} | [
"func",
"(",
"r",
"*",
"SearchResult",
")",
"TotalHits",
"(",
")",
"int64",
"{",
"if",
"r",
".",
"Hits",
"!=",
"nil",
"&&",
"r",
".",
"Hits",
".",
"TotalHits",
"!=",
"nil",
"{",
"return",
"r",
".",
"Hits",
".",
"TotalHits",
".",
"Value",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}"
] | // TotalHits is a convenience function to return the number of hits for
// a search result. The return value might not be accurate, unless
// track_total_hits parameter has set to true. | [
"TotalHits",
"is",
"a",
"convenience",
"function",
"to",
"return",
"the",
"number",
"of",
"hits",
"for",
"a",
"search",
"result",
".",
"The",
"return",
"value",
"might",
"not",
"be",
"accurate",
"unless",
"track_total_hits",
"parameter",
"has",
"set",
"to",
"true",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search.go#L485-L490 | train |
olivere/elastic | errors.go | createResponseError | func createResponseError(res *http.Response) error {
if res.Body == nil {
return &Error{Status: res.StatusCode}
}
data, err := ioutil.ReadAll(res.Body)
if err != nil {
return &Error{Status: res.StatusCode}
}
errReply := new(Error)
err = json.Unmarshal(data, errReply)
if err != nil {
return &Error{Status: res.StatusCode}
}
if errReply != nil {
if errReply.Status == 0 {
errReply.Status = res.StatusCode
}
return errReply
}
return &Error{Status: res.StatusCode}
} | go | func createResponseError(res *http.Response) error {
if res.Body == nil {
return &Error{Status: res.StatusCode}
}
data, err := ioutil.ReadAll(res.Body)
if err != nil {
return &Error{Status: res.StatusCode}
}
errReply := new(Error)
err = json.Unmarshal(data, errReply)
if err != nil {
return &Error{Status: res.StatusCode}
}
if errReply != nil {
if errReply.Status == 0 {
errReply.Status = res.StatusCode
}
return errReply
}
return &Error{Status: res.StatusCode}
} | [
"func",
"createResponseError",
"(",
"res",
"*",
"http",
".",
"Response",
")",
"error",
"{",
"if",
"res",
".",
"Body",
"==",
"nil",
"{",
"return",
"&",
"Error",
"{",
"Status",
":",
"res",
".",
"StatusCode",
"}",
"\n",
"}",
"\n",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"res",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Error",
"{",
"Status",
":",
"res",
".",
"StatusCode",
"}",
"\n",
"}",
"\n",
"errReply",
":=",
"new",
"(",
"Error",
")",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"errReply",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"Error",
"{",
"Status",
":",
"res",
".",
"StatusCode",
"}",
"\n",
"}",
"\n",
"if",
"errReply",
"!=",
"nil",
"{",
"if",
"errReply",
".",
"Status",
"==",
"0",
"{",
"errReply",
".",
"Status",
"=",
"res",
".",
"StatusCode",
"\n",
"}",
"\n",
"return",
"errReply",
"\n",
"}",
"\n",
"return",
"&",
"Error",
"{",
"Status",
":",
"res",
".",
"StatusCode",
"}",
"\n",
"}"
] | // createResponseError creates an Error structure from the HTTP response,
// its status code and the error information sent by Elasticsearch. | [
"createResponseError",
"creates",
"an",
"Error",
"structure",
"from",
"the",
"HTTP",
"response",
"its",
"status",
"code",
"and",
"the",
"error",
"information",
"sent",
"by",
"Elasticsearch",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/errors.go#L44-L64 | train |
olivere/elastic | errors.go | IsConnErr | func IsConnErr(err error) bool {
return err == ErrNoClient || errors.Cause(err) == ErrNoClient
} | go | func IsConnErr(err error) bool {
return err == ErrNoClient || errors.Cause(err) == ErrNoClient
} | [
"func",
"IsConnErr",
"(",
"err",
"error",
")",
"bool",
"{",
"return",
"err",
"==",
"ErrNoClient",
"||",
"errors",
".",
"Cause",
"(",
"err",
")",
"==",
"ErrNoClient",
"\n",
"}"
] | // IsConnErr returns true if the error indicates that Elastic could not
// find an Elasticsearch host to connect to. | [
"IsConnErr",
"returns",
"true",
"if",
"the",
"error",
"indicates",
"that",
"Elastic",
"could",
"not",
"find",
"an",
"Elasticsearch",
"host",
"to",
"connect",
"to",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/errors.go#L113-L115 | train |
olivere/elastic | cluster_health.go | NewClusterHealthService | func NewClusterHealthService(client *Client) *ClusterHealthService {
return &ClusterHealthService{
client: client,
indices: make([]string, 0),
}
} | go | func NewClusterHealthService(client *Client) *ClusterHealthService {
return &ClusterHealthService{
client: client,
indices: make([]string, 0),
}
} | [
"func",
"NewClusterHealthService",
"(",
"client",
"*",
"Client",
")",
"*",
"ClusterHealthService",
"{",
"return",
"&",
"ClusterHealthService",
"{",
"client",
":",
"client",
",",
"indices",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"}",
"\n",
"}"
] | // NewClusterHealthService creates a new ClusterHealthService. | [
"NewClusterHealthService",
"creates",
"a",
"new",
"ClusterHealthService",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_health.go#L35-L40 | train |
olivere/elastic | cluster_health.go | Index | func (s *ClusterHealthService) Index(indices ...string) *ClusterHealthService {
s.indices = append(s.indices, indices...)
return s
} | go | func (s *ClusterHealthService) Index(indices ...string) *ClusterHealthService {
s.indices = append(s.indices, indices...)
return s
} | [
"func",
"(",
"s",
"*",
"ClusterHealthService",
")",
"Index",
"(",
"indices",
"...",
"string",
")",
"*",
"ClusterHealthService",
"{",
"s",
".",
"indices",
"=",
"append",
"(",
"s",
".",
"indices",
",",
"indices",
"...",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // Index limits the information returned to specific indices. | [
"Index",
"limits",
"the",
"information",
"returned",
"to",
"specific",
"indices",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_health.go#L43-L46 | train |
olivere/elastic | cluster_health.go | Level | func (s *ClusterHealthService) Level(level string) *ClusterHealthService {
s.level = level
return s
} | go | func (s *ClusterHealthService) Level(level string) *ClusterHealthService {
s.level = level
return s
} | [
"func",
"(",
"s",
"*",
"ClusterHealthService",
")",
"Level",
"(",
"level",
"string",
")",
"*",
"ClusterHealthService",
"{",
"s",
".",
"level",
"=",
"level",
"\n",
"return",
"s",
"\n",
"}"
] | // Level specifies the level of detail for returned information. | [
"Level",
"specifies",
"the",
"level",
"of",
"detail",
"for",
"returned",
"information",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_health.go#L49-L52 | train |
olivere/elastic | cluster_health.go | WaitForActiveShards | func (s *ClusterHealthService) WaitForActiveShards(waitForActiveShards int) *ClusterHealthService {
s.waitForActiveShards = &waitForActiveShards
return s
} | go | func (s *ClusterHealthService) WaitForActiveShards(waitForActiveShards int) *ClusterHealthService {
s.waitForActiveShards = &waitForActiveShards
return s
} | [
"func",
"(",
"s",
"*",
"ClusterHealthService",
")",
"WaitForActiveShards",
"(",
"waitForActiveShards",
"int",
")",
"*",
"ClusterHealthService",
"{",
"s",
".",
"waitForActiveShards",
"=",
"&",
"waitForActiveShards",
"\n",
"return",
"s",
"\n",
"}"
] | // WaitForActiveShards can be used to wait until the specified number of shards are active. | [
"WaitForActiveShards",
"can",
"be",
"used",
"to",
"wait",
"until",
"the",
"specified",
"number",
"of",
"shards",
"are",
"active",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_health.go#L74-L77 | train |
olivere/elastic | cluster_health.go | WaitForNoRelocatingShards | func (s *ClusterHealthService) WaitForNoRelocatingShards(waitForNoRelocatingShards bool) *ClusterHealthService {
s.waitForNoRelocatingShards = &waitForNoRelocatingShards
return s
} | go | func (s *ClusterHealthService) WaitForNoRelocatingShards(waitForNoRelocatingShards bool) *ClusterHealthService {
s.waitForNoRelocatingShards = &waitForNoRelocatingShards
return s
} | [
"func",
"(",
"s",
"*",
"ClusterHealthService",
")",
"WaitForNoRelocatingShards",
"(",
"waitForNoRelocatingShards",
"bool",
")",
"*",
"ClusterHealthService",
"{",
"s",
".",
"waitForNoRelocatingShards",
"=",
"&",
"waitForNoRelocatingShards",
"\n",
"return",
"s",
"\n",
"}"
] | // WaitForNoRelocatingShards can be used to wait until all shard relocations are finished. | [
"WaitForNoRelocatingShards",
"can",
"be",
"used",
"to",
"wait",
"until",
"all",
"shard",
"relocations",
"are",
"finished",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_health.go#L87-L90 | train |
olivere/elastic | indices_get_mapping.go | NewIndicesGetMappingService | func NewIndicesGetMappingService(client *Client) *IndicesGetMappingService {
return &IndicesGetMappingService{
client: client,
index: make([]string, 0),
typ: make([]string, 0),
}
} | go | func NewIndicesGetMappingService(client *Client) *IndicesGetMappingService {
return &IndicesGetMappingService{
client: client,
index: make([]string, 0),
typ: make([]string, 0),
}
} | [
"func",
"NewIndicesGetMappingService",
"(",
"client",
"*",
"Client",
")",
"*",
"IndicesGetMappingService",
"{",
"return",
"&",
"IndicesGetMappingService",
"{",
"client",
":",
"client",
",",
"index",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"typ",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"}",
"\n",
"}"
] | // NewIndicesGetMappingService creates a new IndicesGetMappingService. | [
"NewIndicesGetMappingService",
"creates",
"a",
"new",
"IndicesGetMappingService",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_get_mapping.go#L39-L45 | train |
olivere/elastic | indices_shrink.go | Source | func (s *IndicesShrinkService) Source(source string) *IndicesShrinkService {
s.source = source
return s
} | go | func (s *IndicesShrinkService) Source(source string) *IndicesShrinkService {
s.source = source
return s
} | [
"func",
"(",
"s",
"*",
"IndicesShrinkService",
")",
"Source",
"(",
"source",
"string",
")",
"*",
"IndicesShrinkService",
"{",
"s",
".",
"source",
"=",
"source",
"\n",
"return",
"s",
"\n",
"}"
] | // Source is the name of the source index to shrink. | [
"Source",
"is",
"the",
"name",
"of",
"the",
"source",
"index",
"to",
"shrink",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_shrink.go#L41-L44 | train |
olivere/elastic | indices_shrink.go | Target | func (s *IndicesShrinkService) Target(target string) *IndicesShrinkService {
s.target = target
return s
} | go | func (s *IndicesShrinkService) Target(target string) *IndicesShrinkService {
s.target = target
return s
} | [
"func",
"(",
"s",
"*",
"IndicesShrinkService",
")",
"Target",
"(",
"target",
"string",
")",
"*",
"IndicesShrinkService",
"{",
"s",
".",
"target",
"=",
"target",
"\n",
"return",
"s",
"\n",
"}"
] | // Target is the name of the target index to shrink into. | [
"Target",
"is",
"the",
"name",
"of",
"the",
"target",
"index",
"to",
"shrink",
"into",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_shrink.go#L47-L50 | train |
olivere/elastic | indices_shrink.go | WaitForActiveShards | func (s *IndicesShrinkService) WaitForActiveShards(waitForActiveShards string) *IndicesShrinkService {
s.waitForActiveShards = waitForActiveShards
return s
} | go | func (s *IndicesShrinkService) WaitForActiveShards(waitForActiveShards string) *IndicesShrinkService {
s.waitForActiveShards = waitForActiveShards
return s
} | [
"func",
"(",
"s",
"*",
"IndicesShrinkService",
")",
"WaitForActiveShards",
"(",
"waitForActiveShards",
"string",
")",
"*",
"IndicesShrinkService",
"{",
"s",
".",
"waitForActiveShards",
"=",
"waitForActiveShards",
"\n",
"return",
"s",
"\n",
"}"
] | // WaitForActiveShards sets the number of active shards to wait for on
// the shrunken index before the operation returns. | [
"WaitForActiveShards",
"sets",
"the",
"number",
"of",
"active",
"shards",
"to",
"wait",
"for",
"on",
"the",
"shrunken",
"index",
"before",
"the",
"operation",
"returns",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_shrink.go#L66-L69 | train |
olivere/elastic | xpack_watcher_put_watch.go | Id | func (s *XPackWatcherPutWatchService) Id(id string) *XPackWatcherPutWatchService {
s.id = id
return s
} | go | func (s *XPackWatcherPutWatchService) Id(id string) *XPackWatcherPutWatchService {
s.id = id
return s
} | [
"func",
"(",
"s",
"*",
"XPackWatcherPutWatchService",
")",
"Id",
"(",
"id",
"string",
")",
"*",
"XPackWatcherPutWatchService",
"{",
"s",
".",
"id",
"=",
"id",
"\n",
"return",
"s",
"\n",
"}"
] | // Id of the watch to upsert. | [
"Id",
"of",
"the",
"watch",
"to",
"upsert",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/xpack_watcher_put_watch.go#L36-L39 | train |
olivere/elastic | search_aggs_bucket_reverse_nested.go | Path | func (a *ReverseNestedAggregation) Path(path string) *ReverseNestedAggregation {
a.path = path
return a
} | go | func (a *ReverseNestedAggregation) Path(path string) *ReverseNestedAggregation {
a.path = path
return a
} | [
"func",
"(",
"a",
"*",
"ReverseNestedAggregation",
")",
"Path",
"(",
"path",
"string",
")",
"*",
"ReverseNestedAggregation",
"{",
"a",
".",
"path",
"=",
"path",
"\n",
"return",
"a",
"\n",
"}"
] | // Path set the path to use for this nested aggregation. The path must match
// the path to a nested object in the mappings. If it is not specified
// then this aggregation will go back to the root document. | [
"Path",
"set",
"the",
"path",
"to",
"use",
"for",
"this",
"nested",
"aggregation",
".",
"The",
"path",
"must",
"match",
"the",
"path",
"to",
"a",
"nested",
"object",
"in",
"the",
"mappings",
".",
"If",
"it",
"is",
"not",
"specified",
"then",
"this",
"aggregation",
"will",
"go",
"back",
"to",
"the",
"root",
"document",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_reverse_nested.go#L32-L35 | train |
olivere/elastic | ping.go | HttpHeadOnly | func (s *PingService) HttpHeadOnly(httpHeadOnly bool) *PingService {
s.httpHeadOnly = httpHeadOnly
return s
} | go | func (s *PingService) HttpHeadOnly(httpHeadOnly bool) *PingService {
s.httpHeadOnly = httpHeadOnly
return s
} | [
"func",
"(",
"s",
"*",
"PingService",
")",
"HttpHeadOnly",
"(",
"httpHeadOnly",
"bool",
")",
"*",
"PingService",
"{",
"s",
".",
"httpHeadOnly",
"=",
"httpHeadOnly",
"\n",
"return",
"s",
"\n",
"}"
] | // HeadOnly makes the service to only return the status code in Do;
// the PingResult will be nil. | [
"HeadOnly",
"makes",
"the",
"service",
"to",
"only",
"return",
"the",
"status",
"code",
"in",
"Do",
";",
"the",
"PingResult",
"will",
"be",
"nil",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/ping.go#L67-L70 | train |
olivere/elastic | search_aggs_pipeline_mov_avg.go | Model | func (a *MovAvgAggregation) Model(model MovAvgModel) *MovAvgAggregation {
a.model = model
return a
} | go | func (a *MovAvgAggregation) Model(model MovAvgModel) *MovAvgAggregation {
a.model = model
return a
} | [
"func",
"(",
"a",
"*",
"MovAvgAggregation",
")",
"Model",
"(",
"model",
"MovAvgModel",
")",
"*",
"MovAvgAggregation",
"{",
"a",
".",
"model",
"=",
"model",
"\n",
"return",
"a",
"\n",
"}"
] | // Model is used to define what type of moving average you want to use
// in the series. | [
"Model",
"is",
"used",
"to",
"define",
"what",
"type",
"of",
"moving",
"average",
"you",
"want",
"to",
"use",
"in",
"the",
"series",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_mov_avg.go#L62-L65 | train |
olivere/elastic | search_aggs_pipeline_mov_avg.go | Window | func (a *MovAvgAggregation) Window(window int) *MovAvgAggregation {
a.window = &window
return a
} | go | func (a *MovAvgAggregation) Window(window int) *MovAvgAggregation {
a.window = &window
return a
} | [
"func",
"(",
"a",
"*",
"MovAvgAggregation",
")",
"Window",
"(",
"window",
"int",
")",
"*",
"MovAvgAggregation",
"{",
"a",
".",
"window",
"=",
"&",
"window",
"\n",
"return",
"a",
"\n",
"}"
] | // Window sets the window size for the moving average. This window will
// "slide" across the series, and the values inside that window will
// be used to calculate the moving avg value. | [
"Window",
"sets",
"the",
"window",
"size",
"for",
"the",
"moving",
"average",
".",
"This",
"window",
"will",
"slide",
"across",
"the",
"series",
"and",
"the",
"values",
"inside",
"that",
"window",
"will",
"be",
"used",
"to",
"calculate",
"the",
"moving",
"avg",
"value",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_mov_avg.go#L70-L73 | train |
olivere/elastic | search_aggs_pipeline_mov_avg.go | Predict | func (a *MovAvgAggregation) Predict(numPredictions int) *MovAvgAggregation {
a.predict = &numPredictions
return a
} | go | func (a *MovAvgAggregation) Predict(numPredictions int) *MovAvgAggregation {
a.predict = &numPredictions
return a
} | [
"func",
"(",
"a",
"*",
"MovAvgAggregation",
")",
"Predict",
"(",
"numPredictions",
"int",
")",
"*",
"MovAvgAggregation",
"{",
"a",
".",
"predict",
"=",
"&",
"numPredictions",
"\n",
"return",
"a",
"\n",
"}"
] | // Predict sets the number of predictions that should be returned.
// Each prediction will be spaced at the intervals in the histogram.
// E.g. a predict of 2 will return two new buckets at the end of the
// histogram with the predicted values. | [
"Predict",
"sets",
"the",
"number",
"of",
"predictions",
"that",
"should",
"be",
"returned",
".",
"Each",
"prediction",
"will",
"be",
"spaced",
"at",
"the",
"intervals",
"in",
"the",
"histogram",
".",
"E",
".",
"g",
".",
"a",
"predict",
"of",
"2",
"will",
"return",
"two",
"new",
"buckets",
"at",
"the",
"end",
"of",
"the",
"histogram",
"with",
"the",
"predicted",
"values",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_mov_avg.go#L79-L82 | train |
olivere/elastic | search_aggs_pipeline_mov_avg.go | Minimize | func (a *MovAvgAggregation) Minimize(minimize bool) *MovAvgAggregation {
a.minimize = &minimize
return a
} | go | func (a *MovAvgAggregation) Minimize(minimize bool) *MovAvgAggregation {
a.minimize = &minimize
return a
} | [
"func",
"(",
"a",
"*",
"MovAvgAggregation",
")",
"Minimize",
"(",
"minimize",
"bool",
")",
"*",
"MovAvgAggregation",
"{",
"a",
".",
"minimize",
"=",
"&",
"minimize",
"\n",
"return",
"a",
"\n",
"}"
] | // Minimize determines if the model should be fit to the data using a
// cost minimizing algorithm. | [
"Minimize",
"determines",
"if",
"the",
"model",
"should",
"be",
"fit",
"to",
"the",
"data",
"using",
"a",
"cost",
"minimizing",
"algorithm",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_mov_avg.go#L86-L89 | train |
olivere/elastic | cat_aliases.go | Alias | func (s *CatAliasesService) Alias(alias ...string) *CatAliasesService {
s.aliases = alias
return s
} | go | func (s *CatAliasesService) Alias(alias ...string) *CatAliasesService {
s.aliases = alias
return s
} | [
"func",
"(",
"s",
"*",
"CatAliasesService",
")",
"Alias",
"(",
"alias",
"...",
"string",
")",
"*",
"CatAliasesService",
"{",
"s",
".",
"aliases",
"=",
"alias",
"\n",
"return",
"s",
"\n",
"}"
] | // Alias specifies one or more aliases to which information should be returned. | [
"Alias",
"specifies",
"one",
"or",
"more",
"aliases",
"to",
"which",
"information",
"should",
"be",
"returned",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cat_aliases.go#L39-L42 | train |
olivere/elastic | fetch_source_context.go | NewFetchSourceContext | func NewFetchSourceContext(fetchSource bool) *FetchSourceContext {
return &FetchSourceContext{
fetchSource: fetchSource,
includes: make([]string, 0),
excludes: make([]string, 0),
}
} | go | func NewFetchSourceContext(fetchSource bool) *FetchSourceContext {
return &FetchSourceContext{
fetchSource: fetchSource,
includes: make([]string, 0),
excludes: make([]string, 0),
}
} | [
"func",
"NewFetchSourceContext",
"(",
"fetchSource",
"bool",
")",
"*",
"FetchSourceContext",
"{",
"return",
"&",
"FetchSourceContext",
"{",
"fetchSource",
":",
"fetchSource",
",",
"includes",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"excludes",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"}",
"\n",
"}"
] | // NewFetchSourceContext returns a new FetchSourceContext. | [
"NewFetchSourceContext",
"returns",
"a",
"new",
"FetchSourceContext",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/fetch_source_context.go#L26-L32 | train |
olivere/elastic | fetch_source_context.go | Include | func (fsc *FetchSourceContext) Include(includes ...string) *FetchSourceContext {
fsc.includes = append(fsc.includes, includes...)
return fsc
} | go | func (fsc *FetchSourceContext) Include(includes ...string) *FetchSourceContext {
fsc.includes = append(fsc.includes, includes...)
return fsc
} | [
"func",
"(",
"fsc",
"*",
"FetchSourceContext",
")",
"Include",
"(",
"includes",
"...",
"string",
")",
"*",
"FetchSourceContext",
"{",
"fsc",
".",
"includes",
"=",
"append",
"(",
"fsc",
".",
"includes",
",",
"includes",
"...",
")",
"\n",
"return",
"fsc",
"\n",
"}"
] | // Include indicates to return specific parts of the _source.
// Wildcards are allowed here. | [
"Include",
"indicates",
"to",
"return",
"specific",
"parts",
"of",
"the",
"_source",
".",
"Wildcards",
"are",
"allowed",
"here",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/fetch_source_context.go#L46-L49 | train |
olivere/elastic | fetch_source_context.go | Exclude | func (fsc *FetchSourceContext) Exclude(excludes ...string) *FetchSourceContext {
fsc.excludes = append(fsc.excludes, excludes...)
return fsc
} | go | func (fsc *FetchSourceContext) Exclude(excludes ...string) *FetchSourceContext {
fsc.excludes = append(fsc.excludes, excludes...)
return fsc
} | [
"func",
"(",
"fsc",
"*",
"FetchSourceContext",
")",
"Exclude",
"(",
"excludes",
"...",
"string",
")",
"*",
"FetchSourceContext",
"{",
"fsc",
".",
"excludes",
"=",
"append",
"(",
"fsc",
".",
"excludes",
",",
"excludes",
"...",
")",
"\n",
"return",
"fsc",
"\n",
"}"
] | // Exclude indicates to exclude specific parts of the _source.
// Wildcards are allowed here. | [
"Exclude",
"indicates",
"to",
"exclude",
"specific",
"parts",
"of",
"the",
"_source",
".",
"Wildcards",
"are",
"allowed",
"here",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/fetch_source_context.go#L53-L56 | train |
olivere/elastic | fetch_source_context.go | Source | func (fsc *FetchSourceContext) Source() (interface{}, error) {
if !fsc.fetchSource {
return false, nil
}
if len(fsc.includes) == 0 && len(fsc.excludes) == 0 {
return true, nil
}
src := make(map[string]interface{})
if len(fsc.includes) > 0 {
src["includes"] = fsc.includes
}
if len(fsc.excludes) > 0 {
src["excludes"] = fsc.excludes
}
return src, nil
} | go | func (fsc *FetchSourceContext) Source() (interface{}, error) {
if !fsc.fetchSource {
return false, nil
}
if len(fsc.includes) == 0 && len(fsc.excludes) == 0 {
return true, nil
}
src := make(map[string]interface{})
if len(fsc.includes) > 0 {
src["includes"] = fsc.includes
}
if len(fsc.excludes) > 0 {
src["excludes"] = fsc.excludes
}
return src, nil
} | [
"func",
"(",
"fsc",
"*",
"FetchSourceContext",
")",
"Source",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"!",
"fsc",
".",
"fetchSource",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"if",
"len",
"(",
"fsc",
".",
"includes",
")",
"==",
"0",
"&&",
"len",
"(",
"fsc",
".",
"excludes",
")",
"==",
"0",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"src",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"len",
"(",
"fsc",
".",
"includes",
")",
">",
"0",
"{",
"src",
"[",
"\"",
"\"",
"]",
"=",
"fsc",
".",
"includes",
"\n",
"}",
"\n",
"if",
"len",
"(",
"fsc",
".",
"excludes",
")",
">",
"0",
"{",
"src",
"[",
"\"",
"\"",
"]",
"=",
"fsc",
".",
"excludes",
"\n",
"}",
"\n",
"return",
"src",
",",
"nil",
"\n",
"}"
] | // Source returns the JSON-serializable data to be used in a body. | [
"Source",
"returns",
"the",
"JSON",
"-",
"serializable",
"data",
"to",
"be",
"used",
"in",
"a",
"body",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/fetch_source_context.go#L59-L74 | train |
olivere/elastic | fetch_source_context.go | Query | func (fsc *FetchSourceContext) Query() url.Values {
params := url.Values{}
if fsc.fetchSource {
if len(fsc.includes) > 0 {
params.Add("_source_includes", strings.Join(fsc.includes, ","))
}
if len(fsc.excludes) > 0 {
params.Add("_source_excludes", strings.Join(fsc.excludes, ","))
}
} else {
params.Add("_source", "false")
}
return params
} | go | func (fsc *FetchSourceContext) Query() url.Values {
params := url.Values{}
if fsc.fetchSource {
if len(fsc.includes) > 0 {
params.Add("_source_includes", strings.Join(fsc.includes, ","))
}
if len(fsc.excludes) > 0 {
params.Add("_source_excludes", strings.Join(fsc.excludes, ","))
}
} else {
params.Add("_source", "false")
}
return params
} | [
"func",
"(",
"fsc",
"*",
"FetchSourceContext",
")",
"Query",
"(",
")",
"url",
".",
"Values",
"{",
"params",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"if",
"fsc",
".",
"fetchSource",
"{",
"if",
"len",
"(",
"fsc",
".",
"includes",
")",
">",
"0",
"{",
"params",
".",
"Add",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"fsc",
".",
"includes",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"fsc",
".",
"excludes",
")",
">",
"0",
"{",
"params",
".",
"Add",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"fsc",
".",
"excludes",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"params",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"params",
"\n",
"}"
] | // Query returns the parameters in a form suitable for a URL query string. | [
"Query",
"returns",
"the",
"parameters",
"in",
"a",
"form",
"suitable",
"for",
"a",
"URL",
"query",
"string",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/fetch_source_context.go#L77-L90 | train |
olivere/elastic | indices_delete.go | NewIndicesDeleteService | func NewIndicesDeleteService(client *Client) *IndicesDeleteService {
return &IndicesDeleteService{
client: client,
index: make([]string, 0),
}
} | go | func NewIndicesDeleteService(client *Client) *IndicesDeleteService {
return &IndicesDeleteService{
client: client,
index: make([]string, 0),
}
} | [
"func",
"NewIndicesDeleteService",
"(",
"client",
"*",
"Client",
")",
"*",
"IndicesDeleteService",
"{",
"return",
"&",
"IndicesDeleteService",
"{",
"client",
":",
"client",
",",
"index",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"}",
"\n",
"}"
] | // NewIndicesDeleteService creates and initializes a new IndicesDeleteService. | [
"NewIndicesDeleteService",
"creates",
"and",
"initializes",
"a",
"new",
"IndicesDeleteService",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_delete.go#L29-L34 | train |
olivere/elastic | snapshot_get_repository.go | NewSnapshotGetRepositoryService | func NewSnapshotGetRepositoryService(client *Client) *SnapshotGetRepositoryService {
return &SnapshotGetRepositoryService{
client: client,
repository: make([]string, 0),
}
} | go | func NewSnapshotGetRepositoryService(client *Client) *SnapshotGetRepositoryService {
return &SnapshotGetRepositoryService{
client: client,
repository: make([]string, 0),
}
} | [
"func",
"NewSnapshotGetRepositoryService",
"(",
"client",
"*",
"Client",
")",
"*",
"SnapshotGetRepositoryService",
"{",
"return",
"&",
"SnapshotGetRepositoryService",
"{",
"client",
":",
"client",
",",
"repository",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"}",
"\n",
"}"
] | // NewSnapshotGetRepositoryService creates a new SnapshotGetRepositoryService. | [
"NewSnapshotGetRepositoryService",
"creates",
"a",
"new",
"SnapshotGetRepositoryService",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/snapshot_get_repository.go#L29-L34 | train |
olivere/elastic | snapshot_get.go | Snapshot | func (s *SnapshotGetService) Snapshot(snapshots ...string) *SnapshotGetService {
s.snapshot = append(s.snapshot, snapshots...)
return s
} | go | func (s *SnapshotGetService) Snapshot(snapshots ...string) *SnapshotGetService {
s.snapshot = append(s.snapshot, snapshots...)
return s
} | [
"func",
"(",
"s",
"*",
"SnapshotGetService",
")",
"Snapshot",
"(",
"snapshots",
"...",
"string",
")",
"*",
"SnapshotGetService",
"{",
"s",
".",
"snapshot",
"=",
"append",
"(",
"s",
".",
"snapshot",
",",
"snapshots",
"...",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // Snapshot is the list of snapshot names. If not set, defaults to all snapshots. | [
"Snapshot",
"is",
"the",
"list",
"of",
"snapshot",
"names",
".",
"If",
"not",
"set",
"defaults",
"to",
"all",
"snapshots",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/snapshot_get.go#L44-L47 | train |
olivere/elastic | snapshot_get.go | IgnoreUnavailable | func (s *SnapshotGetService) IgnoreUnavailable(ignoreUnavailable bool) *SnapshotGetService {
s.ignoreUnavailable = &ignoreUnavailable
return s
} | go | func (s *SnapshotGetService) IgnoreUnavailable(ignoreUnavailable bool) *SnapshotGetService {
s.ignoreUnavailable = &ignoreUnavailable
return s
} | [
"func",
"(",
"s",
"*",
"SnapshotGetService",
")",
"IgnoreUnavailable",
"(",
"ignoreUnavailable",
"bool",
")",
"*",
"SnapshotGetService",
"{",
"s",
".",
"ignoreUnavailable",
"=",
"&",
"ignoreUnavailable",
"\n",
"return",
"s",
"\n",
"}"
] | // IgnoreUnavailable specifies whether to ignore unavailable snapshots, defaults to false | [
"IgnoreUnavailable",
"specifies",
"whether",
"to",
"ignore",
"unavailable",
"snapshots",
"defaults",
"to",
"false"
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/snapshot_get.go#L56-L59 | train |
olivere/elastic | snapshot_get.go | Verbose | func (s *SnapshotGetService) Verbose(verbose bool) *SnapshotGetService {
s.verbose = &verbose
return s
} | go | func (s *SnapshotGetService) Verbose(verbose bool) *SnapshotGetService {
s.verbose = &verbose
return s
} | [
"func",
"(",
"s",
"*",
"SnapshotGetService",
")",
"Verbose",
"(",
"verbose",
"bool",
")",
"*",
"SnapshotGetService",
"{",
"s",
".",
"verbose",
"=",
"&",
"verbose",
"\n",
"return",
"s",
"\n",
"}"
] | // Verbose specifies whether to show verbose snapshot info or only show the basic info found in the repository index blob | [
"Verbose",
"specifies",
"whether",
"to",
"show",
"verbose",
"snapshot",
"info",
"or",
"only",
"show",
"the",
"basic",
"info",
"found",
"in",
"the",
"repository",
"index",
"blob"
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/snapshot_get.go#L62-L65 | train |
olivere/elastic | search_queries_terms_set.go | NewTermsSetQuery | func NewTermsSetQuery(name string, values ...interface{}) *TermsSetQuery {
q := &TermsSetQuery{
name: name,
values: make([]interface{}, 0),
}
if len(values) > 0 {
q.values = append(q.values, values...)
}
return q
} | go | func NewTermsSetQuery(name string, values ...interface{}) *TermsSetQuery {
q := &TermsSetQuery{
name: name,
values: make([]interface{}, 0),
}
if len(values) > 0 {
q.values = append(q.values, values...)
}
return q
} | [
"func",
"NewTermsSetQuery",
"(",
"name",
"string",
",",
"values",
"...",
"interface",
"{",
"}",
")",
"*",
"TermsSetQuery",
"{",
"q",
":=",
"&",
"TermsSetQuery",
"{",
"name",
":",
"name",
",",
"values",
":",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"0",
")",
",",
"}",
"\n",
"if",
"len",
"(",
"values",
")",
">",
"0",
"{",
"q",
".",
"values",
"=",
"append",
"(",
"q",
".",
"values",
",",
"values",
"...",
")",
"\n",
"}",
"\n",
"return",
"q",
"\n",
"}"
] | // NewTermsSetQuery creates and initializes a new TermsSetQuery. | [
"NewTermsSetQuery",
"creates",
"and",
"initializes",
"a",
"new",
"TermsSetQuery",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_terms_set.go#L26-L35 | train |
olivere/elastic | search_queries_terms_set.go | MinimumShouldMatchField | func (q *TermsSetQuery) MinimumShouldMatchField(minimumShouldMatchField string) *TermsSetQuery {
q.minimumShouldMatchField = minimumShouldMatchField
return q
} | go | func (q *TermsSetQuery) MinimumShouldMatchField(minimumShouldMatchField string) *TermsSetQuery {
q.minimumShouldMatchField = minimumShouldMatchField
return q
} | [
"func",
"(",
"q",
"*",
"TermsSetQuery",
")",
"MinimumShouldMatchField",
"(",
"minimumShouldMatchField",
"string",
")",
"*",
"TermsSetQuery",
"{",
"q",
".",
"minimumShouldMatchField",
"=",
"minimumShouldMatchField",
"\n",
"return",
"q",
"\n",
"}"
] | // MinimumShouldMatchField specifies the field to match. | [
"MinimumShouldMatchField",
"specifies",
"the",
"field",
"to",
"match",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_terms_set.go#L38-L41 | train |
olivere/elastic | search_queries_terms_set.go | MinimumShouldMatchScript | func (q *TermsSetQuery) MinimumShouldMatchScript(minimumShouldMatchScript *Script) *TermsSetQuery {
q.minimumShouldMatchScript = minimumShouldMatchScript
return q
} | go | func (q *TermsSetQuery) MinimumShouldMatchScript(minimumShouldMatchScript *Script) *TermsSetQuery {
q.minimumShouldMatchScript = minimumShouldMatchScript
return q
} | [
"func",
"(",
"q",
"*",
"TermsSetQuery",
")",
"MinimumShouldMatchScript",
"(",
"minimumShouldMatchScript",
"*",
"Script",
")",
"*",
"TermsSetQuery",
"{",
"q",
".",
"minimumShouldMatchScript",
"=",
"minimumShouldMatchScript",
"\n",
"return",
"q",
"\n",
"}"
] | // MinimumShouldMatchScript specifies the script to match. | [
"MinimumShouldMatchScript",
"specifies",
"the",
"script",
"to",
"match",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_terms_set.go#L44-L47 | train |
olivere/elastic | search_queries_terms_set.go | Source | func (q *TermsSetQuery) Source() (interface{}, error) {
// {"terms_set":{"codes":{"terms":["abc","def"],"minimum_should_match_field":"required_matches"}}}
source := make(map[string]interface{})
inner := make(map[string]interface{})
params := make(map[string]interface{})
inner[q.name] = params
source["terms_set"] = inner
// terms
params["terms"] = q.values
// minimum_should_match_field
if match := q.minimumShouldMatchField; match != "" {
params["minimum_should_match_field"] = match
}
// minimum_should_match_script
if match := q.minimumShouldMatchScript; match != nil {
src, err := match.Source()
if err != nil {
return nil, err
}
params["minimum_should_match_script"] = src
}
// Common parameters for all queries
if q.boost != nil {
params["boost"] = *q.boost
}
if q.queryName != "" {
params["_name"] = q.queryName
}
return source, nil
} | go | func (q *TermsSetQuery) Source() (interface{}, error) {
// {"terms_set":{"codes":{"terms":["abc","def"],"minimum_should_match_field":"required_matches"}}}
source := make(map[string]interface{})
inner := make(map[string]interface{})
params := make(map[string]interface{})
inner[q.name] = params
source["terms_set"] = inner
// terms
params["terms"] = q.values
// minimum_should_match_field
if match := q.minimumShouldMatchField; match != "" {
params["minimum_should_match_field"] = match
}
// minimum_should_match_script
if match := q.minimumShouldMatchScript; match != nil {
src, err := match.Source()
if err != nil {
return nil, err
}
params["minimum_should_match_script"] = src
}
// Common parameters for all queries
if q.boost != nil {
params["boost"] = *q.boost
}
if q.queryName != "" {
params["_name"] = q.queryName
}
return source, nil
} | [
"func",
"(",
"q",
"*",
"TermsSetQuery",
")",
"Source",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// {\"terms_set\":{\"codes\":{\"terms\":[\"abc\",\"def\"],\"minimum_should_match_field\":\"required_matches\"}}}",
"source",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"inner",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"params",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"inner",
"[",
"q",
".",
"name",
"]",
"=",
"params",
"\n",
"source",
"[",
"\"",
"\"",
"]",
"=",
"inner",
"\n\n",
"// terms",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"values",
"\n\n",
"// minimum_should_match_field",
"if",
"match",
":=",
"q",
".",
"minimumShouldMatchField",
";",
"match",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"match",
"\n",
"}",
"\n\n",
"// minimum_should_match_script",
"if",
"match",
":=",
"q",
".",
"minimumShouldMatchScript",
";",
"match",
"!=",
"nil",
"{",
"src",
",",
"err",
":=",
"match",
".",
"Source",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"params",
"[",
"\"",
"\"",
"]",
"=",
"src",
"\n",
"}",
"\n\n",
"// Common parameters for all queries",
"if",
"q",
".",
"boost",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"boost",
"\n",
"}",
"\n",
"if",
"q",
".",
"queryName",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"queryName",
"\n",
"}",
"\n\n",
"return",
"source",
",",
"nil",
"\n",
"}"
] | // Source creates the query source for the term query. | [
"Source",
"creates",
"the",
"query",
"source",
"for",
"the",
"term",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_terms_set.go#L63-L97 | train |
olivere/elastic | xpack_watcher_deactivate_watch.go | WatchId | func (s *XPackWatcherDeactivateWatchService) WatchId(watchId string) *XPackWatcherDeactivateWatchService {
s.watchId = watchId
return s
} | go | func (s *XPackWatcherDeactivateWatchService) WatchId(watchId string) *XPackWatcherDeactivateWatchService {
s.watchId = watchId
return s
} | [
"func",
"(",
"s",
"*",
"XPackWatcherDeactivateWatchService",
")",
"WatchId",
"(",
"watchId",
"string",
")",
"*",
"XPackWatcherDeactivateWatchService",
"{",
"s",
".",
"watchId",
"=",
"watchId",
"\n",
"return",
"s",
"\n",
"}"
] | // WatchId is the ID of the watch to deactivate. | [
"WatchId",
"is",
"the",
"ID",
"of",
"the",
"watch",
"to",
"deactivate",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/xpack_watcher_deactivate_watch.go#L35-L38 | train |
olivere/elastic | search_queries_simple_query_string.go | NewSimpleQueryStringQuery | func NewSimpleQueryStringQuery(text string) *SimpleQueryStringQuery {
return &SimpleQueryStringQuery{
queryText: text,
fields: make([]string, 0),
fieldBoosts: make(map[string]*float64),
fuzzyPrefixLength: -1,
fuzzyMaxExpansions: -1,
}
} | go | func NewSimpleQueryStringQuery(text string) *SimpleQueryStringQuery {
return &SimpleQueryStringQuery{
queryText: text,
fields: make([]string, 0),
fieldBoosts: make(map[string]*float64),
fuzzyPrefixLength: -1,
fuzzyMaxExpansions: -1,
}
} | [
"func",
"NewSimpleQueryStringQuery",
"(",
"text",
"string",
")",
"*",
"SimpleQueryStringQuery",
"{",
"return",
"&",
"SimpleQueryStringQuery",
"{",
"queryText",
":",
"text",
",",
"fields",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"fieldBoosts",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"float64",
")",
",",
"fuzzyPrefixLength",
":",
"-",
"1",
",",
"fuzzyMaxExpansions",
":",
"-",
"1",
",",
"}",
"\n",
"}"
] | // NewSimpleQueryStringQuery creates and initializes a new SimpleQueryStringQuery. | [
"NewSimpleQueryStringQuery",
"creates",
"and",
"initializes",
"a",
"new",
"SimpleQueryStringQuery",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_simple_query_string.go#L41-L49 | train |
olivere/elastic | search_queries_simple_query_string.go | QuoteFieldSuffix | func (q *SimpleQueryStringQuery) QuoteFieldSuffix(quoteFieldSuffix string) *SimpleQueryStringQuery {
q.quoteFieldSuffix = quoteFieldSuffix
return q
} | go | func (q *SimpleQueryStringQuery) QuoteFieldSuffix(quoteFieldSuffix string) *SimpleQueryStringQuery {
q.quoteFieldSuffix = quoteFieldSuffix
return q
} | [
"func",
"(",
"q",
"*",
"SimpleQueryStringQuery",
")",
"QuoteFieldSuffix",
"(",
"quoteFieldSuffix",
"string",
")",
"*",
"SimpleQueryStringQuery",
"{",
"q",
".",
"quoteFieldSuffix",
"=",
"quoteFieldSuffix",
"\n",
"return",
"q",
"\n",
"}"
] | // QuoteFieldSuffix is an optional field name suffix to automatically
// try and add to the field searched when using quoted text. | [
"QuoteFieldSuffix",
"is",
"an",
"optional",
"field",
"name",
"suffix",
"to",
"automatically",
"try",
"and",
"add",
"to",
"the",
"field",
"searched",
"when",
"using",
"quoted",
"text",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_simple_query_string.go#L72-L75 | train |
olivere/elastic | search_queries_simple_query_string.go | DefaultOperator | func (q *SimpleQueryStringQuery) DefaultOperator(defaultOperator string) *SimpleQueryStringQuery {
q.defaultOperator = defaultOperator
return q
} | go | func (q *SimpleQueryStringQuery) DefaultOperator(defaultOperator string) *SimpleQueryStringQuery {
q.defaultOperator = defaultOperator
return q
} | [
"func",
"(",
"q",
"*",
"SimpleQueryStringQuery",
")",
"DefaultOperator",
"(",
"defaultOperator",
"string",
")",
"*",
"SimpleQueryStringQuery",
"{",
"q",
".",
"defaultOperator",
"=",
"defaultOperator",
"\n",
"return",
"q",
"\n",
"}"
] | // DefaultOperator specifies the default operator for the query. | [
"DefaultOperator",
"specifies",
"the",
"default",
"operator",
"for",
"the",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_simple_query_string.go#L91-L94 | train |
olivere/elastic | search_queries_simple_query_string.go | Flags | func (q *SimpleQueryStringQuery) Flags(flags string) *SimpleQueryStringQuery {
q.flags = flags
return q
} | go | func (q *SimpleQueryStringQuery) Flags(flags string) *SimpleQueryStringQuery {
q.flags = flags
return q
} | [
"func",
"(",
"q",
"*",
"SimpleQueryStringQuery",
")",
"Flags",
"(",
"flags",
"string",
")",
"*",
"SimpleQueryStringQuery",
"{",
"q",
".",
"flags",
"=",
"flags",
"\n",
"return",
"q",
"\n",
"}"
] | // Flags sets the flags for the query. | [
"Flags",
"sets",
"the",
"flags",
"for",
"the",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_simple_query_string.go#L97-L100 | train |
olivere/elastic | search_queries_simple_query_string.go | MinimumShouldMatch | func (q *SimpleQueryStringQuery) MinimumShouldMatch(minimumShouldMatch string) *SimpleQueryStringQuery {
q.minimumShouldMatch = minimumShouldMatch
return q
} | go | func (q *SimpleQueryStringQuery) MinimumShouldMatch(minimumShouldMatch string) *SimpleQueryStringQuery {
q.minimumShouldMatch = minimumShouldMatch
return q
} | [
"func",
"(",
"q",
"*",
"SimpleQueryStringQuery",
")",
"MinimumShouldMatch",
"(",
"minimumShouldMatch",
"string",
")",
"*",
"SimpleQueryStringQuery",
"{",
"q",
".",
"minimumShouldMatch",
"=",
"minimumShouldMatch",
"\n",
"return",
"q",
"\n",
"}"
] | // MinimumShouldMatch specifies the minimumShouldMatch to apply to the
// resulting query should that be a Boolean query. | [
"MinimumShouldMatch",
"specifies",
"the",
"minimumShouldMatch",
"to",
"apply",
"to",
"the",
"resulting",
"query",
"should",
"that",
"be",
"a",
"Boolean",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_simple_query_string.go#L135-L138 | train |
olivere/elastic | search_queries_simple_query_string.go | AutoGenerateSynonymsPhraseQuery | func (q *SimpleQueryStringQuery) AutoGenerateSynonymsPhraseQuery(enable bool) *SimpleQueryStringQuery {
q.autoGenerateSynonymsPhraseQuery = &enable
return q
} | go | func (q *SimpleQueryStringQuery) AutoGenerateSynonymsPhraseQuery(enable bool) *SimpleQueryStringQuery {
q.autoGenerateSynonymsPhraseQuery = &enable
return q
} | [
"func",
"(",
"q",
"*",
"SimpleQueryStringQuery",
")",
"AutoGenerateSynonymsPhraseQuery",
"(",
"enable",
"bool",
")",
"*",
"SimpleQueryStringQuery",
"{",
"q",
".",
"autoGenerateSynonymsPhraseQuery",
"=",
"&",
"enable",
"\n",
"return",
"q",
"\n",
"}"
] | // AutoGenerateSynonymsPhraseQuery indicates whether phrase queries should be
// automatically generated for multi terms synonyms. Defaults to true. | [
"AutoGenerateSynonymsPhraseQuery",
"indicates",
"whether",
"phrase",
"queries",
"should",
"be",
"automatically",
"generated",
"for",
"multi",
"terms",
"synonyms",
".",
"Defaults",
"to",
"true",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_simple_query_string.go#L142-L145 | train |
olivere/elastic | search_queries_simple_query_string.go | FuzzyPrefixLength | func (q *SimpleQueryStringQuery) FuzzyPrefixLength(fuzzyPrefixLength int) *SimpleQueryStringQuery {
q.fuzzyPrefixLength = fuzzyPrefixLength
return q
} | go | func (q *SimpleQueryStringQuery) FuzzyPrefixLength(fuzzyPrefixLength int) *SimpleQueryStringQuery {
q.fuzzyPrefixLength = fuzzyPrefixLength
return q
} | [
"func",
"(",
"q",
"*",
"SimpleQueryStringQuery",
")",
"FuzzyPrefixLength",
"(",
"fuzzyPrefixLength",
"int",
")",
"*",
"SimpleQueryStringQuery",
"{",
"q",
".",
"fuzzyPrefixLength",
"=",
"fuzzyPrefixLength",
"\n",
"return",
"q",
"\n",
"}"
] | // FuzzyPrefixLength defines the prefix length in fuzzy queries. | [
"FuzzyPrefixLength",
"defines",
"the",
"prefix",
"length",
"in",
"fuzzy",
"queries",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_simple_query_string.go#L148-L151 | train |
olivere/elastic | search_queries_simple_query_string.go | FuzzyMaxExpansions | func (q *SimpleQueryStringQuery) FuzzyMaxExpansions(fuzzyMaxExpansions int) *SimpleQueryStringQuery {
q.fuzzyMaxExpansions = fuzzyMaxExpansions
return q
} | go | func (q *SimpleQueryStringQuery) FuzzyMaxExpansions(fuzzyMaxExpansions int) *SimpleQueryStringQuery {
q.fuzzyMaxExpansions = fuzzyMaxExpansions
return q
} | [
"func",
"(",
"q",
"*",
"SimpleQueryStringQuery",
")",
"FuzzyMaxExpansions",
"(",
"fuzzyMaxExpansions",
"int",
")",
"*",
"SimpleQueryStringQuery",
"{",
"q",
".",
"fuzzyMaxExpansions",
"=",
"fuzzyMaxExpansions",
"\n",
"return",
"q",
"\n",
"}"
] | // FuzzyMaxExpansions defines the number of terms fuzzy queries will expand to. | [
"FuzzyMaxExpansions",
"defines",
"the",
"number",
"of",
"terms",
"fuzzy",
"queries",
"will",
"expand",
"to",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_simple_query_string.go#L154-L157 | train |
olivere/elastic | search_queries_simple_query_string.go | FuzzyTranspositions | func (q *SimpleQueryStringQuery) FuzzyTranspositions(fuzzyTranspositions bool) *SimpleQueryStringQuery {
q.fuzzyTranspositions = &fuzzyTranspositions
return q
} | go | func (q *SimpleQueryStringQuery) FuzzyTranspositions(fuzzyTranspositions bool) *SimpleQueryStringQuery {
q.fuzzyTranspositions = &fuzzyTranspositions
return q
} | [
"func",
"(",
"q",
"*",
"SimpleQueryStringQuery",
")",
"FuzzyTranspositions",
"(",
"fuzzyTranspositions",
"bool",
")",
"*",
"SimpleQueryStringQuery",
"{",
"q",
".",
"fuzzyTranspositions",
"=",
"&",
"fuzzyTranspositions",
"\n",
"return",
"q",
"\n",
"}"
] | // FuzzyTranspositions defines whether to use transpositions in fuzzy queries. | [
"FuzzyTranspositions",
"defines",
"whether",
"to",
"use",
"transpositions",
"in",
"fuzzy",
"queries",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_simple_query_string.go#L160-L163 | train |
olivere/elastic | search_queries_geo_bounding_box.go | Type | func (q *GeoBoundingBoxQuery) Type(typ string) *GeoBoundingBoxQuery {
q.typ = typ
return q
} | go | func (q *GeoBoundingBoxQuery) Type(typ string) *GeoBoundingBoxQuery {
q.typ = typ
return q
} | [
"func",
"(",
"q",
"*",
"GeoBoundingBoxQuery",
")",
"Type",
"(",
"typ",
"string",
")",
"*",
"GeoBoundingBoxQuery",
"{",
"q",
".",
"typ",
"=",
"typ",
"\n",
"return",
"q",
"\n",
"}"
] | // Type sets the type of executing the geo bounding box. It can be either
// memory or indexed. It defaults to memory. | [
"Type",
"sets",
"the",
"type",
"of",
"executing",
"the",
"geo",
"bounding",
"box",
".",
"It",
"can",
"be",
"either",
"memory",
"or",
"indexed",
".",
"It",
"defaults",
"to",
"memory",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_geo_bounding_box.go#L73-L76 | train |
olivere/elastic | search_aggs_pipeline_mov_fn.go | Window | func (a *MovFnAggregation) Window(window int) *MovFnAggregation {
a.window = window
return a
} | go | func (a *MovFnAggregation) Window(window int) *MovFnAggregation {
a.window = window
return a
} | [
"func",
"(",
"a",
"*",
"MovFnAggregation",
")",
"Window",
"(",
"window",
"int",
")",
"*",
"MovFnAggregation",
"{",
"a",
".",
"window",
"=",
"window",
"\n",
"return",
"a",
"\n",
"}"
] | // Window sets the window size for this aggregation. | [
"Window",
"sets",
"the",
"window",
"size",
"for",
"this",
"aggregation",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_mov_fn.go#L77-L80 | train |
olivere/elastic | connection.go | newConn | func newConn(nodeID, url string) *conn {
c := &conn{
nodeID: nodeID,
url: url,
}
return c
} | go | func newConn(nodeID, url string) *conn {
c := &conn{
nodeID: nodeID,
url: url,
}
return c
} | [
"func",
"newConn",
"(",
"nodeID",
",",
"url",
"string",
")",
"*",
"conn",
"{",
"c",
":=",
"&",
"conn",
"{",
"nodeID",
":",
"nodeID",
",",
"url",
":",
"url",
",",
"}",
"\n",
"return",
"c",
"\n",
"}"
] | // newConn creates a new connection to the given URL. | [
"newConn",
"creates",
"a",
"new",
"connection",
"to",
"the",
"given",
"URL",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/connection.go#L24-L30 | train |
olivere/elastic | connection.go | String | func (c *conn) String() string {
c.RLock()
defer c.RUnlock()
return fmt.Sprintf("%s [dead=%v,failures=%d,deadSince=%v]", c.url, c.dead, c.failures, c.deadSince)
} | go | func (c *conn) String() string {
c.RLock()
defer c.RUnlock()
return fmt.Sprintf("%s [dead=%v,failures=%d,deadSince=%v]", c.url, c.dead, c.failures, c.deadSince)
} | [
"func",
"(",
"c",
"*",
"conn",
")",
"String",
"(",
")",
"string",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"url",
",",
"c",
".",
"dead",
",",
"c",
".",
"failures",
",",
"c",
".",
"deadSince",
")",
"\n",
"}"
] | // String returns a representation of the connection status. | [
"String",
"returns",
"a",
"representation",
"of",
"the",
"connection",
"status",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/connection.go#L33-L37 | train |
olivere/elastic | connection.go | NodeID | func (c *conn) NodeID() string {
c.RLock()
defer c.RUnlock()
return c.nodeID
} | go | func (c *conn) NodeID() string {
c.RLock()
defer c.RUnlock()
return c.nodeID
} | [
"func",
"(",
"c",
"*",
"conn",
")",
"NodeID",
"(",
")",
"string",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"c",
".",
"nodeID",
"\n",
"}"
] | // NodeID returns the ID of the node of this connection. | [
"NodeID",
"returns",
"the",
"ID",
"of",
"the",
"node",
"of",
"this",
"connection",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/connection.go#L40-L44 | train |
olivere/elastic | connection.go | URL | func (c *conn) URL() string {
c.RLock()
defer c.RUnlock()
return c.url
} | go | func (c *conn) URL() string {
c.RLock()
defer c.RUnlock()
return c.url
} | [
"func",
"(",
"c",
"*",
"conn",
")",
"URL",
"(",
")",
"string",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"c",
".",
"url",
"\n",
"}"
] | // URL returns the URL of this connection. | [
"URL",
"returns",
"the",
"URL",
"of",
"this",
"connection",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/connection.go#L47-L51 | train |
olivere/elastic | connection.go | IsDead | func (c *conn) IsDead() bool {
c.RLock()
defer c.RUnlock()
return c.dead
} | go | func (c *conn) IsDead() bool {
c.RLock()
defer c.RUnlock()
return c.dead
} | [
"func",
"(",
"c",
"*",
"conn",
")",
"IsDead",
"(",
")",
"bool",
"{",
"c",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"c",
".",
"dead",
"\n",
"}"
] | // IsDead returns true if this connection is marked as dead, i.e. a previous
// request to the URL has been unsuccessful. | [
"IsDead",
"returns",
"true",
"if",
"this",
"connection",
"is",
"marked",
"as",
"dead",
"i",
".",
"e",
".",
"a",
"previous",
"request",
"to",
"the",
"URL",
"has",
"been",
"unsuccessful",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/connection.go#L55-L59 | train |
olivere/elastic | connection.go | MarkAsDead | func (c *conn) MarkAsDead() {
c.Lock()
c.dead = true
if c.deadSince == nil {
utcNow := time.Now().UTC()
c.deadSince = &utcNow
}
c.failures += 1
c.Unlock()
} | go | func (c *conn) MarkAsDead() {
c.Lock()
c.dead = true
if c.deadSince == nil {
utcNow := time.Now().UTC()
c.deadSince = &utcNow
}
c.failures += 1
c.Unlock()
} | [
"func",
"(",
"c",
"*",
"conn",
")",
"MarkAsDead",
"(",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"dead",
"=",
"true",
"\n",
"if",
"c",
".",
"deadSince",
"==",
"nil",
"{",
"utcNow",
":=",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
"\n",
"c",
".",
"deadSince",
"=",
"&",
"utcNow",
"\n",
"}",
"\n",
"c",
".",
"failures",
"+=",
"1",
"\n",
"c",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // MarkAsDead marks this connection as dead, increments the failures
// counter and stores the current time in dead since. | [
"MarkAsDead",
"marks",
"this",
"connection",
"as",
"dead",
"increments",
"the",
"failures",
"counter",
"and",
"stores",
"the",
"current",
"time",
"in",
"dead",
"since",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/connection.go#L63-L72 | train |
olivere/elastic | connection.go | MarkAsAlive | func (c *conn) MarkAsAlive() {
c.Lock()
c.dead = false
c.Unlock()
} | go | func (c *conn) MarkAsAlive() {
c.Lock()
c.dead = false
c.Unlock()
} | [
"func",
"(",
"c",
"*",
"conn",
")",
"MarkAsAlive",
"(",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"dead",
"=",
"false",
"\n",
"c",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // MarkAsAlive marks this connection as eligible to be returned from the
// pool of connections by the selector. | [
"MarkAsAlive",
"marks",
"this",
"connection",
"as",
"eligible",
"to",
"be",
"returned",
"from",
"the",
"pool",
"of",
"connections",
"by",
"the",
"selector",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/connection.go#L76-L80 | train |
olivere/elastic | connection.go | MarkAsHealthy | func (c *conn) MarkAsHealthy() {
c.Lock()
c.dead = false
c.deadSince = nil
c.failures = 0
c.Unlock()
} | go | func (c *conn) MarkAsHealthy() {
c.Lock()
c.dead = false
c.deadSince = nil
c.failures = 0
c.Unlock()
} | [
"func",
"(",
"c",
"*",
"conn",
")",
"MarkAsHealthy",
"(",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"dead",
"=",
"false",
"\n",
"c",
".",
"deadSince",
"=",
"nil",
"\n",
"c",
".",
"failures",
"=",
"0",
"\n",
"c",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // MarkAsHealthy marks this connection as healthy, i.e. a request has been
// successfully performed with it. | [
"MarkAsHealthy",
"marks",
"this",
"connection",
"as",
"healthy",
"i",
".",
"e",
".",
"a",
"request",
"has",
"been",
"successfully",
"performed",
"with",
"it",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/connection.go#L84-L90 | train |
olivere/elastic | xpack_watcher_get_watch.go | Id | func (s *XPackWatcherGetWatchService) Id(id string) *XPackWatcherGetWatchService {
s.id = id
return s
} | go | func (s *XPackWatcherGetWatchService) Id(id string) *XPackWatcherGetWatchService {
s.id = id
return s
} | [
"func",
"(",
"s",
"*",
"XPackWatcherGetWatchService",
")",
"Id",
"(",
"id",
"string",
")",
"*",
"XPackWatcherGetWatchService",
"{",
"s",
".",
"id",
"=",
"id",
"\n",
"return",
"s",
"\n",
"}"
] | // Id is ID of the watch to retrieve. | [
"Id",
"is",
"ID",
"of",
"the",
"watch",
"to",
"retrieve",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/xpack_watcher_get_watch.go#L33-L36 | train |
olivere/elastic | xpack_security_get_role.go | Name | func (s *XPackSecurityGetRoleService) Name(name string) *XPackSecurityGetRoleService {
s.name = name
return s
} | go | func (s *XPackSecurityGetRoleService) Name(name string) *XPackSecurityGetRoleService {
s.name = name
return s
} | [
"func",
"(",
"s",
"*",
"XPackSecurityGetRoleService",
")",
"Name",
"(",
"name",
"string",
")",
"*",
"XPackSecurityGetRoleService",
"{",
"s",
".",
"name",
"=",
"name",
"\n",
"return",
"s",
"\n",
"}"
] | // Name is name of the role to retrieve. | [
"Name",
"is",
"name",
"of",
"the",
"role",
"to",
"retrieve",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/xpack_security_get_role.go#L32-L35 | train |
olivere/elastic | xpack_watcher_stats.go | Metric | func (s *XPackWatcherStatsService) Metric(metric string) *XPackWatcherStatsService {
s.metric = metric
return s
} | go | func (s *XPackWatcherStatsService) Metric(metric string) *XPackWatcherStatsService {
s.metric = metric
return s
} | [
"func",
"(",
"s",
"*",
"XPackWatcherStatsService",
")",
"Metric",
"(",
"metric",
"string",
")",
"*",
"XPackWatcherStatsService",
"{",
"s",
".",
"metric",
"=",
"metric",
"\n",
"return",
"s",
"\n",
"}"
] | // Metric controls what additional stat metrics should be include in the response. | [
"Metric",
"controls",
"what",
"additional",
"stat",
"metrics",
"should",
"be",
"include",
"in",
"the",
"response",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/xpack_watcher_stats.go#L31-L34 | train |
olivere/elastic | xpack_watcher_stats.go | EmitStacktraces | func (s *XPackWatcherStatsService) EmitStacktraces(emitStacktraces bool) *XPackWatcherStatsService {
s.emitStacktraces = &emitStacktraces
return s
} | go | func (s *XPackWatcherStatsService) EmitStacktraces(emitStacktraces bool) *XPackWatcherStatsService {
s.emitStacktraces = &emitStacktraces
return s
} | [
"func",
"(",
"s",
"*",
"XPackWatcherStatsService",
")",
"EmitStacktraces",
"(",
"emitStacktraces",
"bool",
")",
"*",
"XPackWatcherStatsService",
"{",
"s",
".",
"emitStacktraces",
"=",
"&",
"emitStacktraces",
"\n",
"return",
"s",
"\n",
"}"
] | // EmitStacktraces, if enabled, emits stack traces of currently running watches. | [
"EmitStacktraces",
"if",
"enabled",
"emits",
"stack",
"traces",
"of",
"currently",
"running",
"watches",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/xpack_watcher_stats.go#L37-L40 | train |
olivere/elastic | suggester_phrase.go | NewPhraseSuggester | func NewPhraseSuggester(name string) *PhraseSuggester {
return &PhraseSuggester{
name: name,
collateParams: make(map[string]interface{}),
}
} | go | func NewPhraseSuggester(name string) *PhraseSuggester {
return &PhraseSuggester{
name: name,
collateParams: make(map[string]interface{}),
}
} | [
"func",
"NewPhraseSuggester",
"(",
"name",
"string",
")",
"*",
"PhraseSuggester",
"{",
"return",
"&",
"PhraseSuggester",
"{",
"name",
":",
"name",
",",
"collateParams",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
",",
"}",
"\n",
"}"
] | // NewPhraseSuggester creates a new PhraseSuggester. | [
"NewPhraseSuggester",
"creates",
"a",
"new",
"PhraseSuggester",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/suggester_phrase.go#L39-L44 | train |
olivere/elastic | search_queries_fsq.go | Query | func (q *FunctionScoreQuery) Query(query Query) *FunctionScoreQuery {
q.query = query
return q
} | go | func (q *FunctionScoreQuery) Query(query Query) *FunctionScoreQuery {
q.query = query
return q
} | [
"func",
"(",
"q",
"*",
"FunctionScoreQuery",
")",
"Query",
"(",
"query",
"Query",
")",
"*",
"FunctionScoreQuery",
"{",
"q",
".",
"query",
"=",
"query",
"\n",
"return",
"q",
"\n",
"}"
] | // Query sets the query for the function score query. | [
"Query",
"sets",
"the",
"query",
"for",
"the",
"function",
"score",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_fsq.go#L36-L39 | train |
olivere/elastic | search_queries_fsq.go | Filter | func (q *FunctionScoreQuery) Filter(filter Query) *FunctionScoreQuery {
q.filter = filter
return q
} | go | func (q *FunctionScoreQuery) Filter(filter Query) *FunctionScoreQuery {
q.filter = filter
return q
} | [
"func",
"(",
"q",
"*",
"FunctionScoreQuery",
")",
"Filter",
"(",
"filter",
"Query",
")",
"*",
"FunctionScoreQuery",
"{",
"q",
".",
"filter",
"=",
"filter",
"\n",
"return",
"q",
"\n",
"}"
] | // Filter sets the filter for the function score query. | [
"Filter",
"sets",
"the",
"filter",
"for",
"the",
"function",
"score",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_fsq.go#L42-L45 | train |
olivere/elastic | search_queries_fsq.go | MaxBoost | func (q *FunctionScoreQuery) MaxBoost(maxBoost float64) *FunctionScoreQuery {
q.maxBoost = &maxBoost
return q
} | go | func (q *FunctionScoreQuery) MaxBoost(maxBoost float64) *FunctionScoreQuery {
q.maxBoost = &maxBoost
return q
} | [
"func",
"(",
"q",
"*",
"FunctionScoreQuery",
")",
"MaxBoost",
"(",
"maxBoost",
"float64",
")",
"*",
"FunctionScoreQuery",
"{",
"q",
".",
"maxBoost",
"=",
"&",
"maxBoost",
"\n",
"return",
"q",
"\n",
"}"
] | // MaxBoost is the maximum boost that will be applied by function score. | [
"MaxBoost",
"is",
"the",
"maximum",
"boost",
"that",
"will",
"be",
"applied",
"by",
"function",
"score",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_fsq.go#L77-L80 | train |
olivere/elastic | search_queries_fsq.go | MinScore | func (q *FunctionScoreQuery) MinScore(minScore float64) *FunctionScoreQuery {
q.minScore = &minScore
return q
} | go | func (q *FunctionScoreQuery) MinScore(minScore float64) *FunctionScoreQuery {
q.minScore = &minScore
return q
} | [
"func",
"(",
"q",
"*",
"FunctionScoreQuery",
")",
"MinScore",
"(",
"minScore",
"float64",
")",
"*",
"FunctionScoreQuery",
"{",
"q",
".",
"minScore",
"=",
"&",
"minScore",
"\n",
"return",
"q",
"\n",
"}"
] | // MinScore sets the minimum score. | [
"MinScore",
"sets",
"the",
"minimum",
"score",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_fsq.go#L91-L94 | train |
olivere/elastic | search_aggs_pipeline_bucket_sort.go | Sort | func (a *BucketSortAggregation) Sort(field string, ascending bool) *BucketSortAggregation {
a.sorters = append(a.sorters, SortInfo{Field: field, Ascending: ascending})
return a
} | go | func (a *BucketSortAggregation) Sort(field string, ascending bool) *BucketSortAggregation {
a.sorters = append(a.sorters, SortInfo{Field: field, Ascending: ascending})
return a
} | [
"func",
"(",
"a",
"*",
"BucketSortAggregation",
")",
"Sort",
"(",
"field",
"string",
",",
"ascending",
"bool",
")",
"*",
"BucketSortAggregation",
"{",
"a",
".",
"sorters",
"=",
"append",
"(",
"a",
".",
"sorters",
",",
"SortInfo",
"{",
"Field",
":",
"field",
",",
"Ascending",
":",
"ascending",
"}",
")",
"\n",
"return",
"a",
"\n",
"}"
] | // Sort adds a sort order to the list of sorters. | [
"Sort",
"adds",
"a",
"sort",
"order",
"to",
"the",
"list",
"of",
"sorters",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_bucket_sort.go#L32-L35 | train |
olivere/elastic | search_aggs_pipeline_bucket_sort.go | SortWithInfo | func (a *BucketSortAggregation) SortWithInfo(info SortInfo) *BucketSortAggregation {
a.sorters = append(a.sorters, info)
return a
} | go | func (a *BucketSortAggregation) SortWithInfo(info SortInfo) *BucketSortAggregation {
a.sorters = append(a.sorters, info)
return a
} | [
"func",
"(",
"a",
"*",
"BucketSortAggregation",
")",
"SortWithInfo",
"(",
"info",
"SortInfo",
")",
"*",
"BucketSortAggregation",
"{",
"a",
".",
"sorters",
"=",
"append",
"(",
"a",
".",
"sorters",
",",
"info",
")",
"\n",
"return",
"a",
"\n",
"}"
] | // SortWithInfo adds a SortInfo to the list of sorters. | [
"SortWithInfo",
"adds",
"a",
"SortInfo",
"to",
"the",
"list",
"of",
"sorters",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_bucket_sort.go#L38-L41 | train |
olivere/elastic | search_aggs_pipeline_bucket_sort.go | From | func (a *BucketSortAggregation) From(from int) *BucketSortAggregation {
a.from = from
return a
} | go | func (a *BucketSortAggregation) From(from int) *BucketSortAggregation {
a.from = from
return a
} | [
"func",
"(",
"a",
"*",
"BucketSortAggregation",
")",
"From",
"(",
"from",
"int",
")",
"*",
"BucketSortAggregation",
"{",
"a",
".",
"from",
"=",
"from",
"\n",
"return",
"a",
"\n",
"}"
] | // From adds the "from" parameter to the aggregation. | [
"From",
"adds",
"the",
"from",
"parameter",
"to",
"the",
"aggregation",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_bucket_sort.go#L44-L47 | train |
olivere/elastic | search_aggs_pipeline_bucket_sort.go | Size | func (a *BucketSortAggregation) Size(size int) *BucketSortAggregation {
a.size = size
return a
} | go | func (a *BucketSortAggregation) Size(size int) *BucketSortAggregation {
a.size = size
return a
} | [
"func",
"(",
"a",
"*",
"BucketSortAggregation",
")",
"Size",
"(",
"size",
"int",
")",
"*",
"BucketSortAggregation",
"{",
"a",
".",
"size",
"=",
"size",
"\n",
"return",
"a",
"\n",
"}"
] | // Size adds the "size" parameter to the aggregation. | [
"Size",
"adds",
"the",
"size",
"parameter",
"to",
"the",
"aggregation",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_bucket_sort.go#L50-L53 | train |
olivere/elastic | search_aggs_pipeline_bucket_sort.go | GapPolicy | func (a *BucketSortAggregation) GapPolicy(gapPolicy string) *BucketSortAggregation {
a.gapPolicy = gapPolicy
return a
} | go | func (a *BucketSortAggregation) GapPolicy(gapPolicy string) *BucketSortAggregation {
a.gapPolicy = gapPolicy
return a
} | [
"func",
"(",
"a",
"*",
"BucketSortAggregation",
")",
"GapPolicy",
"(",
"gapPolicy",
"string",
")",
"*",
"BucketSortAggregation",
"{",
"a",
".",
"gapPolicy",
"=",
"gapPolicy",
"\n",
"return",
"a",
"\n",
"}"
] | // GapPolicy defines what should be done when a gap in the series is discovered.
// Valid values include "insert_zeros" or "skip". Default is "skip". | [
"GapPolicy",
"defines",
"what",
"should",
"be",
"done",
"when",
"a",
"gap",
"in",
"the",
"series",
"is",
"discovered",
".",
"Valid",
"values",
"include",
"insert_zeros",
"or",
"skip",
".",
"Default",
"is",
"skip",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_bucket_sort.go#L57-L60 | train |
olivere/elastic | search_aggs_pipeline_bucket_sort.go | Meta | func (a *BucketSortAggregation) Meta(meta map[string]interface{}) *BucketSortAggregation {
a.meta = meta
return a
} | go | func (a *BucketSortAggregation) Meta(meta map[string]interface{}) *BucketSortAggregation {
a.meta = meta
return a
} | [
"func",
"(",
"a",
"*",
"BucketSortAggregation",
")",
"Meta",
"(",
"meta",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"*",
"BucketSortAggregation",
"{",
"a",
".",
"meta",
"=",
"meta",
"\n",
"return",
"a",
"\n",
"}"
] | // Meta sets the meta data in the aggregation.
// Although metadata is supported for this aggregation by Elasticsearch, it's important to
// note that there's no use to it because this aggregation does not include new data in the
// response. It merely reorders parent buckets. | [
"Meta",
"sets",
"the",
"meta",
"data",
"in",
"the",
"aggregation",
".",
"Although",
"metadata",
"is",
"supported",
"for",
"this",
"aggregation",
"by",
"Elasticsearch",
"it",
"s",
"important",
"to",
"note",
"that",
"there",
"s",
"no",
"use",
"to",
"it",
"because",
"this",
"aggregation",
"does",
"not",
"include",
"new",
"data",
"in",
"the",
"response",
".",
"It",
"merely",
"reorders",
"parent",
"buckets",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_bucket_sort.go#L78-L81 | train |
olivere/elastic | search_queries_percolator.go | Name | func (q *PercolatorQuery) Name(name string) *PercolatorQuery {
q.name = name
return q
} | go | func (q *PercolatorQuery) Name(name string) *PercolatorQuery {
q.name = name
return q
} | [
"func",
"(",
"q",
"*",
"PercolatorQuery",
")",
"Name",
"(",
"name",
"string",
")",
"*",
"PercolatorQuery",
"{",
"q",
".",
"name",
"=",
"name",
"\n",
"return",
"q",
"\n",
"}"
] | // Name used for identification purposes in "_percolator_document_slot" response
// field when multiple percolate queries have been specified in the main query. | [
"Name",
"used",
"for",
"identification",
"purposes",
"in",
"_percolator_document_slot",
"response",
"field",
"when",
"multiple",
"percolate",
"queries",
"have",
"been",
"specified",
"in",
"the",
"main",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_percolator.go#L38-L41 | train |
olivere/elastic | search_queries_percolator.go | Source | func (q *PercolatorQuery) Source() (interface{}, error) {
if len(q.field) == 0 {
return nil, errors.New("elastic: Field is required in PercolatorQuery")
}
// {
// "percolate" : { ... }
// }
source := make(map[string]interface{})
params := make(map[string]interface{})
source["percolate"] = params
params["field"] = q.field
if q.documentType != "" {
params["document_type"] = q.documentType
}
if q.name != "" {
params["name"] = q.name
}
switch len(q.documents) {
case 0:
case 1:
params["document"] = q.documents[0]
default:
params["documents"] = q.documents
}
if s := q.indexedDocumentIndex; s != "" {
params["index"] = s
}
if s := q.indexedDocumentType; s != "" {
params["type"] = s
}
if s := q.indexedDocumentId; s != "" {
params["id"] = s
}
if s := q.indexedDocumentRouting; s != "" {
params["routing"] = s
}
if s := q.indexedDocumentPreference; s != "" {
params["preference"] = s
}
if v := q.indexedDocumentVersion; v != nil {
params["version"] = *v
}
return source, nil
} | go | func (q *PercolatorQuery) Source() (interface{}, error) {
if len(q.field) == 0 {
return nil, errors.New("elastic: Field is required in PercolatorQuery")
}
// {
// "percolate" : { ... }
// }
source := make(map[string]interface{})
params := make(map[string]interface{})
source["percolate"] = params
params["field"] = q.field
if q.documentType != "" {
params["document_type"] = q.documentType
}
if q.name != "" {
params["name"] = q.name
}
switch len(q.documents) {
case 0:
case 1:
params["document"] = q.documents[0]
default:
params["documents"] = q.documents
}
if s := q.indexedDocumentIndex; s != "" {
params["index"] = s
}
if s := q.indexedDocumentType; s != "" {
params["type"] = s
}
if s := q.indexedDocumentId; s != "" {
params["id"] = s
}
if s := q.indexedDocumentRouting; s != "" {
params["routing"] = s
}
if s := q.indexedDocumentPreference; s != "" {
params["preference"] = s
}
if v := q.indexedDocumentVersion; v != nil {
params["version"] = *v
}
return source, nil
} | [
"func",
"(",
"q",
"*",
"PercolatorQuery",
")",
"Source",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"len",
"(",
"q",
".",
"field",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// {",
"// \"percolate\" : { ... }",
"// }",
"source",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"params",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"source",
"[",
"\"",
"\"",
"]",
"=",
"params",
"\n",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"field",
"\n",
"if",
"q",
".",
"documentType",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"documentType",
"\n",
"}",
"\n",
"if",
"q",
".",
"name",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"name",
"\n",
"}",
"\n\n",
"switch",
"len",
"(",
"q",
".",
"documents",
")",
"{",
"case",
"0",
":",
"case",
"1",
":",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"documents",
"[",
"0",
"]",
"\n",
"default",
":",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"documents",
"\n",
"}",
"\n\n",
"if",
"s",
":=",
"q",
".",
"indexedDocumentIndex",
";",
"s",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"s",
"\n",
"}",
"\n",
"if",
"s",
":=",
"q",
".",
"indexedDocumentType",
";",
"s",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"s",
"\n",
"}",
"\n",
"if",
"s",
":=",
"q",
".",
"indexedDocumentId",
";",
"s",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"s",
"\n",
"}",
"\n",
"if",
"s",
":=",
"q",
".",
"indexedDocumentRouting",
";",
"s",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"s",
"\n",
"}",
"\n",
"if",
"s",
":=",
"q",
".",
"indexedDocumentPreference",
";",
"s",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"s",
"\n",
"}",
"\n",
"if",
"v",
":=",
"q",
".",
"indexedDocumentVersion",
";",
"v",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"v",
"\n",
"}",
"\n",
"return",
"source",
",",
"nil",
"\n",
"}"
] | // Source returns JSON for the percolate query. | [
"Source",
"returns",
"JSON",
"for",
"the",
"percolate",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_percolator.go#L85-L131 | train |
olivere/elastic | bulk_update_request.go | Index | func (r *BulkUpdateRequest) Index(index string) *BulkUpdateRequest {
r.index = index
r.source = nil
return r
} | go | func (r *BulkUpdateRequest) Index(index string) *BulkUpdateRequest {
r.index = index
r.source = nil
return r
} | [
"func",
"(",
"r",
"*",
"BulkUpdateRequest",
")",
"Index",
"(",
"index",
"string",
")",
"*",
"BulkUpdateRequest",
"{",
"r",
".",
"index",
"=",
"index",
"\n",
"r",
".",
"source",
"=",
"nil",
"\n",
"return",
"r",
"\n",
"}"
] | // Index specifies the Elasticsearch index to use for this update request.
// If unspecified, the index set on the BulkService will be used. | [
"Index",
"specifies",
"the",
"Elasticsearch",
"index",
"to",
"use",
"for",
"this",
"update",
"request",
".",
"If",
"unspecified",
"the",
"index",
"set",
"on",
"the",
"BulkService",
"will",
"be",
"used",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/bulk_update_request.go#L87-L91 | train |
olivere/elastic | bulk_update_request.go | Type | func (r *BulkUpdateRequest) Type(typ string) *BulkUpdateRequest {
r.typ = typ
r.source = nil
return r
} | go | func (r *BulkUpdateRequest) Type(typ string) *BulkUpdateRequest {
r.typ = typ
r.source = nil
return r
} | [
"func",
"(",
"r",
"*",
"BulkUpdateRequest",
")",
"Type",
"(",
"typ",
"string",
")",
"*",
"BulkUpdateRequest",
"{",
"r",
".",
"typ",
"=",
"typ",
"\n",
"r",
".",
"source",
"=",
"nil",
"\n",
"return",
"r",
"\n",
"}"
] | // Type specifies the Elasticsearch type to use for this update request.
// If unspecified, the type set on the BulkService will be used. | [
"Type",
"specifies",
"the",
"Elasticsearch",
"type",
"to",
"use",
"for",
"this",
"update",
"request",
".",
"If",
"unspecified",
"the",
"type",
"set",
"on",
"the",
"BulkService",
"will",
"be",
"used",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/bulk_update_request.go#L95-L99 | train |
olivere/elastic | bulk_update_request.go | Id | func (r *BulkUpdateRequest) Id(id string) *BulkUpdateRequest {
r.id = id
r.source = nil
return r
} | go | func (r *BulkUpdateRequest) Id(id string) *BulkUpdateRequest {
r.id = id
r.source = nil
return r
} | [
"func",
"(",
"r",
"*",
"BulkUpdateRequest",
")",
"Id",
"(",
"id",
"string",
")",
"*",
"BulkUpdateRequest",
"{",
"r",
".",
"id",
"=",
"id",
"\n",
"r",
".",
"source",
"=",
"nil",
"\n",
"return",
"r",
"\n",
"}"
] | // Id specifies the identifier of the document to update. | [
"Id",
"specifies",
"the",
"identifier",
"of",
"the",
"document",
"to",
"update",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/bulk_update_request.go#L102-L106 | train |
olivere/elastic | bulk_update_request.go | Doc | func (r *BulkUpdateRequest) Doc(doc interface{}) *BulkUpdateRequest {
r.doc = doc
r.source = nil
return r
} | go | func (r *BulkUpdateRequest) Doc(doc interface{}) *BulkUpdateRequest {
r.doc = doc
r.source = nil
return r
} | [
"func",
"(",
"r",
"*",
"BulkUpdateRequest",
")",
"Doc",
"(",
"doc",
"interface",
"{",
"}",
")",
"*",
"BulkUpdateRequest",
"{",
"r",
".",
"doc",
"=",
"doc",
"\n",
"r",
".",
"source",
"=",
"nil",
"\n",
"return",
"r",
"\n",
"}"
] | // Doc specifies the updated document. | [
"Doc",
"specifies",
"the",
"updated",
"document",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/bulk_update_request.go#L166-L170 | train |
olivere/elastic | bulk_update_request.go | Upsert | func (r *BulkUpdateRequest) Upsert(doc interface{}) *BulkUpdateRequest {
r.upsert = doc
r.source = nil
return r
} | go | func (r *BulkUpdateRequest) Upsert(doc interface{}) *BulkUpdateRequest {
r.upsert = doc
r.source = nil
return r
} | [
"func",
"(",
"r",
"*",
"BulkUpdateRequest",
")",
"Upsert",
"(",
"doc",
"interface",
"{",
"}",
")",
"*",
"BulkUpdateRequest",
"{",
"r",
".",
"upsert",
"=",
"doc",
"\n",
"r",
".",
"source",
"=",
"nil",
"\n",
"return",
"r",
"\n",
"}"
] | // Upsert specifies the document to use for upserts. It will be used for
// create if the original document does not exist. | [
"Upsert",
"specifies",
"the",
"document",
"to",
"use",
"for",
"upserts",
".",
"It",
"will",
"be",
"used",
"for",
"create",
"if",
"the",
"original",
"document",
"does",
"not",
"exist",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/bulk_update_request.go#L194-L198 | train |
olivere/elastic | bulk_update_request.go | ReturnSource | func (r *BulkUpdateRequest) ReturnSource(source bool) *BulkUpdateRequest {
r.returnSource = &source
r.source = nil
return r
} | go | func (r *BulkUpdateRequest) ReturnSource(source bool) *BulkUpdateRequest {
r.returnSource = &source
r.source = nil
return r
} | [
"func",
"(",
"r",
"*",
"BulkUpdateRequest",
")",
"ReturnSource",
"(",
"source",
"bool",
")",
"*",
"BulkUpdateRequest",
"{",
"r",
".",
"returnSource",
"=",
"&",
"source",
"\n",
"r",
".",
"source",
"=",
"nil",
"\n",
"return",
"r",
"\n",
"}"
] | // ReturnSource specifies whether Elasticsearch should return the source
// after the update. In the request, this responds to the `_source` field.
// It is false by default. | [
"ReturnSource",
"specifies",
"whether",
"Elasticsearch",
"should",
"return",
"the",
"source",
"after",
"the",
"update",
".",
"In",
"the",
"request",
"this",
"responds",
"to",
"the",
"_source",
"field",
".",
"It",
"is",
"false",
"by",
"default",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/bulk_update_request.go#L203-L207 | train |
olivere/elastic | indices_get_aliases.go | Pretty | func (s *AliasesService) Pretty(pretty bool) *AliasesService {
s.pretty = pretty
return s
} | go | func (s *AliasesService) Pretty(pretty bool) *AliasesService {
s.pretty = pretty
return s
} | [
"func",
"(",
"s",
"*",
"AliasesService",
")",
"Pretty",
"(",
"pretty",
"bool",
")",
"*",
"AliasesService",
"{",
"s",
".",
"pretty",
"=",
"pretty",
"\n",
"return",
"s",
"\n",
"}"
] | // Pretty asks Elasticsearch to indent the returned JSON. | [
"Pretty",
"asks",
"Elasticsearch",
"to",
"indent",
"the",
"returned",
"JSON",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_get_aliases.go#L35-L38 | train |
olivere/elastic | indices_get_aliases.go | Index | func (s *AliasesService) Index(index ...string) *AliasesService {
s.index = append(s.index, index...)
return s
} | go | func (s *AliasesService) Index(index ...string) *AliasesService {
s.index = append(s.index, index...)
return s
} | [
"func",
"(",
"s",
"*",
"AliasesService",
")",
"Index",
"(",
"index",
"...",
"string",
")",
"*",
"AliasesService",
"{",
"s",
".",
"index",
"=",
"append",
"(",
"s",
".",
"index",
",",
"index",
"...",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // Index adds one or more indices. | [
"Index",
"adds",
"one",
"or",
"more",
"indices",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_get_aliases.go#L41-L44 | train |
olivere/elastic | indices_get_aliases.go | Alias | func (s *AliasesService) Alias(alias ...string) *AliasesService {
s.alias = append(s.alias, alias...)
return s
} | go | func (s *AliasesService) Alias(alias ...string) *AliasesService {
s.alias = append(s.alias, alias...)
return s
} | [
"func",
"(",
"s",
"*",
"AliasesService",
")",
"Alias",
"(",
"alias",
"...",
"string",
")",
"*",
"AliasesService",
"{",
"s",
".",
"alias",
"=",
"append",
"(",
"s",
".",
"alias",
",",
"alias",
"...",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // Alias adds one or more aliases. | [
"Alias",
"adds",
"one",
"or",
"more",
"aliases",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_get_aliases.go#L47-L50 | train |
olivere/elastic | indices_get_aliases.go | IndicesByAlias | func (ar AliasesResult) IndicesByAlias(aliasName string) []string {
var indices []string
for indexName, indexInfo := range ar.Indices {
for _, aliasInfo := range indexInfo.Aliases {
if aliasInfo.AliasName == aliasName {
indices = append(indices, indexName)
}
}
}
return indices
} | go | func (ar AliasesResult) IndicesByAlias(aliasName string) []string {
var indices []string
for indexName, indexInfo := range ar.Indices {
for _, aliasInfo := range indexInfo.Aliases {
if aliasInfo.AliasName == aliasName {
indices = append(indices, indexName)
}
}
}
return indices
} | [
"func",
"(",
"ar",
"AliasesResult",
")",
"IndicesByAlias",
"(",
"aliasName",
"string",
")",
"[",
"]",
"string",
"{",
"var",
"indices",
"[",
"]",
"string",
"\n",
"for",
"indexName",
",",
"indexInfo",
":=",
"range",
"ar",
".",
"Indices",
"{",
"for",
"_",
",",
"aliasInfo",
":=",
"range",
"indexInfo",
".",
"Aliases",
"{",
"if",
"aliasInfo",
".",
"AliasName",
"==",
"aliasName",
"{",
"indices",
"=",
"append",
"(",
"indices",
",",
"indexName",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"indices",
"\n",
"}"
] | // IndicesByAlias returns all indices given a specific alias name. | [
"IndicesByAlias",
"returns",
"all",
"indices",
"given",
"a",
"specific",
"alias",
"name",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_get_aliases.go#L159-L169 | train |
olivere/elastic | indices_get_aliases.go | HasAlias | func (ir indexResult) HasAlias(aliasName string) bool {
for _, alias := range ir.Aliases {
if alias.AliasName == aliasName {
return true
}
}
return false
} | go | func (ir indexResult) HasAlias(aliasName string) bool {
for _, alias := range ir.Aliases {
if alias.AliasName == aliasName {
return true
}
}
return false
} | [
"func",
"(",
"ir",
"indexResult",
")",
"HasAlias",
"(",
"aliasName",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"alias",
":=",
"range",
"ir",
".",
"Aliases",
"{",
"if",
"alias",
".",
"AliasName",
"==",
"aliasName",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // HasAlias returns true if the index has a specific alias. | [
"HasAlias",
"returns",
"true",
"if",
"the",
"index",
"has",
"a",
"specific",
"alias",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_get_aliases.go#L172-L179 | train |
olivere/elastic | search_queries_match_phrase.go | NewMatchPhraseQuery | func NewMatchPhraseQuery(name string, value interface{}) *MatchPhraseQuery {
return &MatchPhraseQuery{name: name, value: value}
} | go | func NewMatchPhraseQuery(name string, value interface{}) *MatchPhraseQuery {
return &MatchPhraseQuery{name: name, value: value}
} | [
"func",
"NewMatchPhraseQuery",
"(",
"name",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"*",
"MatchPhraseQuery",
"{",
"return",
"&",
"MatchPhraseQuery",
"{",
"name",
":",
"name",
",",
"value",
":",
"value",
"}",
"\n",
"}"
] | // NewMatchPhraseQuery creates and initializes a new MatchPhraseQuery. | [
"NewMatchPhraseQuery",
"creates",
"and",
"initializes",
"a",
"new",
"MatchPhraseQuery",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_match_phrase.go#L22-L24 | train |
olivere/elastic | backoff.go | Next | func (b *ConstantBackoff) Next(retry int) (time.Duration, bool) {
return b.interval, true
} | go | func (b *ConstantBackoff) Next(retry int) (time.Duration, bool) {
return b.interval, true
} | [
"func",
"(",
"b",
"*",
"ConstantBackoff",
")",
"Next",
"(",
"retry",
"int",
")",
"(",
"time",
".",
"Duration",
",",
"bool",
")",
"{",
"return",
"b",
".",
"interval",
",",
"true",
"\n",
"}"
] | // Next implements BackoffFunc for ConstantBackoff. | [
"Next",
"implements",
"BackoffFunc",
"for",
"ConstantBackoff",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/backoff.go#L61-L63 | train |
olivere/elastic | backoff.go | Next | func (b *ExponentialBackoff) Next(retry int) (time.Duration, bool) {
r := 1.0 + rand.Float64() // random number in [1..2]
m := math.Min(r*b.t*math.Pow(b.f, float64(retry)), b.m)
if m >= b.m {
return 0, false
}
d := time.Duration(int64(m)) * time.Millisecond
return d, true
} | go | func (b *ExponentialBackoff) Next(retry int) (time.Duration, bool) {
r := 1.0 + rand.Float64() // random number in [1..2]
m := math.Min(r*b.t*math.Pow(b.f, float64(retry)), b.m)
if m >= b.m {
return 0, false
}
d := time.Duration(int64(m)) * time.Millisecond
return d, true
} | [
"func",
"(",
"b",
"*",
"ExponentialBackoff",
")",
"Next",
"(",
"retry",
"int",
")",
"(",
"time",
".",
"Duration",
",",
"bool",
")",
"{",
"r",
":=",
"1.0",
"+",
"rand",
".",
"Float64",
"(",
")",
"// random number in [1..2]",
"\n",
"m",
":=",
"math",
".",
"Min",
"(",
"r",
"*",
"b",
".",
"t",
"*",
"math",
".",
"Pow",
"(",
"b",
".",
"f",
",",
"float64",
"(",
"retry",
")",
")",
",",
"b",
".",
"m",
")",
"\n",
"if",
"m",
">=",
"b",
".",
"m",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"d",
":=",
"time",
".",
"Duration",
"(",
"int64",
"(",
"m",
")",
")",
"*",
"time",
".",
"Millisecond",
"\n",
"return",
"d",
",",
"true",
"\n",
"}"
] | // Next implements BackoffFunc for ExponentialBackoff. | [
"Next",
"implements",
"BackoffFunc",
"for",
"ExponentialBackoff",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/backoff.go#L87-L95 | train |
olivere/elastic | backoff.go | Jitter | func (b *SimpleBackoff) Jitter(flag bool) *SimpleBackoff {
b.Lock()
b.jitter = flag
b.Unlock()
return b
} | go | func (b *SimpleBackoff) Jitter(flag bool) *SimpleBackoff {
b.Lock()
b.jitter = flag
b.Unlock()
return b
} | [
"func",
"(",
"b",
"*",
"SimpleBackoff",
")",
"Jitter",
"(",
"flag",
"bool",
")",
"*",
"SimpleBackoff",
"{",
"b",
".",
"Lock",
"(",
")",
"\n",
"b",
".",
"jitter",
"=",
"flag",
"\n",
"b",
".",
"Unlock",
"(",
")",
"\n",
"return",
"b",
"\n",
"}"
] | // Jitter enables or disables jittering values. | [
"Jitter",
"enables",
"or",
"disables",
"jittering",
"values",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/backoff.go#L119-L124 | train |
olivere/elastic | backoff.go | Next | func (b *SimpleBackoff) Next(retry int) (time.Duration, bool) {
b.Lock()
defer b.Unlock()
if retry >= len(b.ticks) {
return 0, false
}
ms := b.ticks[retry]
if b.jitter {
ms = jitter(ms)
}
return time.Duration(ms) * time.Millisecond, true
} | go | func (b *SimpleBackoff) Next(retry int) (time.Duration, bool) {
b.Lock()
defer b.Unlock()
if retry >= len(b.ticks) {
return 0, false
}
ms := b.ticks[retry]
if b.jitter {
ms = jitter(ms)
}
return time.Duration(ms) * time.Millisecond, true
} | [
"func",
"(",
"b",
"*",
"SimpleBackoff",
")",
"Next",
"(",
"retry",
"int",
")",
"(",
"time",
".",
"Duration",
",",
"bool",
")",
"{",
"b",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"retry",
">=",
"len",
"(",
"b",
".",
"ticks",
")",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n\n",
"ms",
":=",
"b",
".",
"ticks",
"[",
"retry",
"]",
"\n",
"if",
"b",
".",
"jitter",
"{",
"ms",
"=",
"jitter",
"(",
"ms",
")",
"\n",
"}",
"\n",
"return",
"time",
".",
"Duration",
"(",
"ms",
")",
"*",
"time",
".",
"Millisecond",
",",
"true",
"\n",
"}"
] | // Next implements BackoffFunc for SimpleBackoff. | [
"Next",
"implements",
"BackoffFunc",
"for",
"SimpleBackoff",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/backoff.go#L135-L148 | train |
olivere/elastic | search_queries_exists.go | QueryName | func (q *ExistsQuery) QueryName(queryName string) *ExistsQuery {
q.queryName = queryName
return q
} | go | func (q *ExistsQuery) QueryName(queryName string) *ExistsQuery {
q.queryName = queryName
return q
} | [
"func",
"(",
"q",
"*",
"ExistsQuery",
")",
"QueryName",
"(",
"queryName",
"string",
")",
"*",
"ExistsQuery",
"{",
"q",
".",
"queryName",
"=",
"queryName",
"\n",
"return",
"q",
"\n",
"}"
] | // QueryName sets the query name for the filter that can be used
// when searching for matched queries per hit. | [
"QueryName",
"sets",
"the",
"query",
"name",
"for",
"the",
"filter",
"that",
"can",
"be",
"used",
"when",
"searching",
"for",
"matched",
"queries",
"per",
"hit",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_exists.go#L26-L29 | train |
olivere/elastic | indices_get.go | NewIndicesGetService | func NewIndicesGetService(client *Client) *IndicesGetService {
return &IndicesGetService{
client: client,
index: make([]string, 0),
feature: make([]string, 0),
}
} | go | func NewIndicesGetService(client *Client) *IndicesGetService {
return &IndicesGetService{
client: client,
index: make([]string, 0),
feature: make([]string, 0),
}
} | [
"func",
"NewIndicesGetService",
"(",
"client",
"*",
"Client",
")",
"*",
"IndicesGetService",
"{",
"return",
"&",
"IndicesGetService",
"{",
"client",
":",
"client",
",",
"index",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"feature",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"}",
"\n",
"}"
] | // NewIndicesGetService creates a new IndicesGetService. | [
"NewIndicesGetService",
"creates",
"a",
"new",
"IndicesGetService",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_get.go#L34-L40 | train |
olivere/elastic | indices_get.go | Feature | func (s *IndicesGetService) Feature(features ...string) *IndicesGetService {
s.feature = append(s.feature, features...)
return s
} | go | func (s *IndicesGetService) Feature(features ...string) *IndicesGetService {
s.feature = append(s.feature, features...)
return s
} | [
"func",
"(",
"s",
"*",
"IndicesGetService",
")",
"Feature",
"(",
"features",
"...",
"string",
")",
"*",
"IndicesGetService",
"{",
"s",
".",
"feature",
"=",
"append",
"(",
"s",
".",
"feature",
",",
"features",
"...",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // Feature is a list of features. | [
"Feature",
"is",
"a",
"list",
"of",
"features",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_get.go#L49-L52 | train |
olivere/elastic | search_queries_has_parent.go | NewHasParentQuery | func NewHasParentQuery(parentType string, query Query) *HasParentQuery {
return &HasParentQuery{
query: query,
parentType: parentType,
}
} | go | func NewHasParentQuery(parentType string, query Query) *HasParentQuery {
return &HasParentQuery{
query: query,
parentType: parentType,
}
} | [
"func",
"NewHasParentQuery",
"(",
"parentType",
"string",
",",
"query",
"Query",
")",
"*",
"HasParentQuery",
"{",
"return",
"&",
"HasParentQuery",
"{",
"query",
":",
"query",
",",
"parentType",
":",
"parentType",
",",
"}",
"\n",
"}"
] | // NewHasParentQuery creates and initializes a new has_parent query. | [
"NewHasParentQuery",
"creates",
"and",
"initializes",
"a",
"new",
"has_parent",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_has_parent.go#L26-L31 | train |
olivere/elastic | search_queries_has_parent.go | Score | func (q *HasParentQuery) Score(score bool) *HasParentQuery {
q.score = &score
return q
} | go | func (q *HasParentQuery) Score(score bool) *HasParentQuery {
q.score = &score
return q
} | [
"func",
"(",
"q",
"*",
"HasParentQuery",
")",
"Score",
"(",
"score",
"bool",
")",
"*",
"HasParentQuery",
"{",
"q",
".",
"score",
"=",
"&",
"score",
"\n",
"return",
"q",
"\n",
"}"
] | // Score defines if the parent score is mapped into the child documents. | [
"Score",
"defines",
"if",
"the",
"parent",
"score",
"is",
"mapped",
"into",
"the",
"child",
"documents",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_has_parent.go#L40-L43 | train |
olivere/elastic | xpack_watcher_delete_watch.go | Id | func (s *XPackWatcherDeleteWatchService) Id(id string) *XPackWatcherDeleteWatchService {
s.id = id
return s
} | go | func (s *XPackWatcherDeleteWatchService) Id(id string) *XPackWatcherDeleteWatchService {
s.id = id
return s
} | [
"func",
"(",
"s",
"*",
"XPackWatcherDeleteWatchService",
")",
"Id",
"(",
"id",
"string",
")",
"*",
"XPackWatcherDeleteWatchService",
"{",
"s",
".",
"id",
"=",
"id",
"\n",
"return",
"s",
"\n",
"}"
] | // Id of the watch to delete. | [
"Id",
"of",
"the",
"watch",
"to",
"delete",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/xpack_watcher_delete_watch.go#L33-L36 | train |
olivere/elastic | cluster_stats.go | NewClusterStatsService | func NewClusterStatsService(client *Client) *ClusterStatsService {
return &ClusterStatsService{
client: client,
nodeId: make([]string, 0),
}
} | go | func NewClusterStatsService(client *Client) *ClusterStatsService {
return &ClusterStatsService{
client: client,
nodeId: make([]string, 0),
}
} | [
"func",
"NewClusterStatsService",
"(",
"client",
"*",
"Client",
")",
"*",
"ClusterStatsService",
"{",
"return",
"&",
"ClusterStatsService",
"{",
"client",
":",
"client",
",",
"nodeId",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"}",
"\n",
"}"
] | // NewClusterStatsService creates a new ClusterStatsService. | [
"NewClusterStatsService",
"creates",
"a",
"new",
"ClusterStatsService",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_stats.go#L27-L32 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.