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 | indices_analyze.go | CharFilter | func (s *IndicesAnalyzeService) CharFilter(charFilter ...string) *IndicesAnalyzeService {
s.request.CharFilter = charFilter
return s
} | go | func (s *IndicesAnalyzeService) CharFilter(charFilter ...string) *IndicesAnalyzeService {
s.request.CharFilter = charFilter
return s
} | [
"func",
"(",
"s",
"*",
"IndicesAnalyzeService",
")",
"CharFilter",
"(",
"charFilter",
"...",
"string",
")",
"*",
"IndicesAnalyzeService",
"{",
"s",
".",
"request",
".",
"CharFilter",
"=",
"charFilter",
"\n",
"return",
"s",
"\n",
"}"
] | // CharFilter is a list of character filters to use for the analysis. | [
"CharFilter",
"is",
"a",
"list",
"of",
"character",
"filters",
"to",
"use",
"for",
"the",
"analysis",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_analyze.go#L82-L85 | train |
olivere/elastic | indices_analyze.go | Filter | func (s *IndicesAnalyzeService) Filter(filter ...string) *IndicesAnalyzeService {
s.request.Filter = filter
return s
} | go | func (s *IndicesAnalyzeService) Filter(filter ...string) *IndicesAnalyzeService {
s.request.Filter = filter
return s
} | [
"func",
"(",
"s",
"*",
"IndicesAnalyzeService",
")",
"Filter",
"(",
"filter",
"...",
"string",
")",
"*",
"IndicesAnalyzeService",
"{",
"s",
".",
"request",
".",
"Filter",
"=",
"filter",
"\n",
"return",
"s",
"\n",
"}"
] | // Filter is a list of filters to use for the analysis. | [
"Filter",
"is",
"a",
"list",
"of",
"filters",
"to",
"use",
"for",
"the",
"analysis",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_analyze.go#L100-L103 | train |
olivere/elastic | indices_analyze.go | Tokenizer | func (s *IndicesAnalyzeService) Tokenizer(tokenizer string) *IndicesAnalyzeService {
s.request.Tokenizer = tokenizer
return s
} | go | func (s *IndicesAnalyzeService) Tokenizer(tokenizer string) *IndicesAnalyzeService {
s.request.Tokenizer = tokenizer
return s
} | [
"func",
"(",
"s",
"*",
"IndicesAnalyzeService",
")",
"Tokenizer",
"(",
"tokenizer",
"string",
")",
"*",
"IndicesAnalyzeService",
"{",
"s",
".",
"request",
".",
"Tokenizer",
"=",
"tokenizer",
"\n",
"return",
"s",
"\n",
"}"
] | // Tokenizer is the name of the tokenizer to use for the analysis. | [
"Tokenizer",
"is",
"the",
"name",
"of",
"the",
"tokenizer",
"to",
"use",
"for",
"the",
"analysis",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_analyze.go#L112-L115 | train |
olivere/elastic | indices_analyze.go | BodyString | func (s *IndicesAnalyzeService) BodyString(body string) *IndicesAnalyzeService {
s.bodyString = body
return s
} | go | func (s *IndicesAnalyzeService) BodyString(body string) *IndicesAnalyzeService {
s.bodyString = body
return s
} | [
"func",
"(",
"s",
"*",
"IndicesAnalyzeService",
")",
"BodyString",
"(",
"body",
"string",
")",
"*",
"IndicesAnalyzeService",
"{",
"s",
".",
"bodyString",
"=",
"body",
"\n",
"return",
"s",
"\n",
"}"
] | // BodyString is the text on which the analysis should be performed. | [
"BodyString",
"is",
"the",
"text",
"on",
"which",
"the",
"analysis",
"should",
"be",
"performed",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_analyze.go#L130-L133 | train |
olivere/elastic | indices_flush.go | NewIndicesFlushService | func NewIndicesFlushService(client *Client) *IndicesFlushService {
return &IndicesFlushService{
client: client,
index: make([]string, 0),
}
} | go | func NewIndicesFlushService(client *Client) *IndicesFlushService {
return &IndicesFlushService{
client: client,
index: make([]string, 0),
}
} | [
"func",
"NewIndicesFlushService",
"(",
"client",
"*",
"Client",
")",
"*",
"IndicesFlushService",
"{",
"return",
"&",
"IndicesFlushService",
"{",
"client",
":",
"client",
",",
"index",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"}",
"\n",
"}"
] | // NewIndicesFlushService creates a new IndicesFlushService. | [
"NewIndicesFlushService",
"creates",
"a",
"new",
"IndicesFlushService",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_flush.go#L34-L39 | train |
olivere/elastic | indices_flush.go | WaitIfOngoing | func (s *IndicesFlushService) WaitIfOngoing(waitIfOngoing bool) *IndicesFlushService {
s.waitIfOngoing = &waitIfOngoing
return s
} | go | func (s *IndicesFlushService) WaitIfOngoing(waitIfOngoing bool) *IndicesFlushService {
s.waitIfOngoing = &waitIfOngoing
return s
} | [
"func",
"(",
"s",
"*",
"IndicesFlushService",
")",
"WaitIfOngoing",
"(",
"waitIfOngoing",
"bool",
")",
"*",
"IndicesFlushService",
"{",
"s",
".",
"waitIfOngoing",
"=",
"&",
"waitIfOngoing",
"\n",
"return",
"s",
"\n",
"}"
] | // WaitIfOngoing, if set to true, indicates that the flush operation will
// block until the flush can be executed if another flush operation is
// already executing. The default is false and will cause an exception
// to be thrown on the shard level if another flush operation is already running.. | [
"WaitIfOngoing",
"if",
"set",
"to",
"true",
"indicates",
"that",
"the",
"flush",
"operation",
"will",
"block",
"until",
"the",
"flush",
"can",
"be",
"executed",
"if",
"another",
"flush",
"operation",
"is",
"already",
"executing",
".",
"The",
"default",
"is",
"false",
"and",
"will",
"cause",
"an",
"exception",
"to",
"be",
"thrown",
"on",
"the",
"shard",
"level",
"if",
"another",
"flush",
"operation",
"is",
"already",
"running",
".."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_flush.go#L60-L63 | train |
olivere/elastic | search_aggs_pipeline_bucket_selector.go | AddBucketsPath | func (a *BucketSelectorAggregation) AddBucketsPath(name, path string) *BucketSelectorAggregation {
if a.bucketsPathsMap == nil {
a.bucketsPathsMap = make(map[string]string)
}
a.bucketsPathsMap[name] = path
return a
} | go | func (a *BucketSelectorAggregation) AddBucketsPath(name, path string) *BucketSelectorAggregation {
if a.bucketsPathsMap == nil {
a.bucketsPathsMap = make(map[string]string)
}
a.bucketsPathsMap[name] = path
return a
} | [
"func",
"(",
"a",
"*",
"BucketSelectorAggregation",
")",
"AddBucketsPath",
"(",
"name",
",",
"path",
"string",
")",
"*",
"BucketSelectorAggregation",
"{",
"if",
"a",
".",
"bucketsPathsMap",
"==",
"nil",
"{",
"a",
".",
"bucketsPathsMap",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"}",
"\n",
"a",
".",
"bucketsPathsMap",
"[",
"name",
"]",
"=",
"path",
"\n",
"return",
"a",
"\n",
"}"
] | // AddBucketsPath adds a bucket path to use for this pipeline aggregator. | [
"AddBucketsPath",
"adds",
"a",
"bucket",
"path",
"to",
"use",
"for",
"this",
"pipeline",
"aggregator",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_bucket_selector.go#L76-L82 | train |
olivere/elastic | cluster_reroute.go | DryRun | func (s *ClusterRerouteService) DryRun(dryRun bool) *ClusterRerouteService {
s.dryRun = &dryRun
return s
} | go | func (s *ClusterRerouteService) DryRun(dryRun bool) *ClusterRerouteService {
s.dryRun = &dryRun
return s
} | [
"func",
"(",
"s",
"*",
"ClusterRerouteService",
")",
"DryRun",
"(",
"dryRun",
"bool",
")",
"*",
"ClusterRerouteService",
"{",
"s",
".",
"dryRun",
"=",
"&",
"dryRun",
"\n",
"return",
"s",
"\n",
"}"
] | // DryRun indicates whether to simulate the operation only and return the
// resulting state. | [
"DryRun",
"indicates",
"whether",
"to",
"simulate",
"the",
"operation",
"only",
"and",
"return",
"the",
"resulting",
"state",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_reroute.go#L52-L55 | train |
olivere/elastic | cluster_reroute.go | Explain | func (s *ClusterRerouteService) Explain(explain bool) *ClusterRerouteService {
s.explain = &explain
return s
} | go | func (s *ClusterRerouteService) Explain(explain bool) *ClusterRerouteService {
s.explain = &explain
return s
} | [
"func",
"(",
"s",
"*",
"ClusterRerouteService",
")",
"Explain",
"(",
"explain",
"bool",
")",
"*",
"ClusterRerouteService",
"{",
"s",
".",
"explain",
"=",
"&",
"explain",
"\n",
"return",
"s",
"\n",
"}"
] | // Explain, when set to true, returns an explanation of why the commands
// can or cannot be executed. | [
"Explain",
"when",
"set",
"to",
"true",
"returns",
"an",
"explanation",
"of",
"why",
"the",
"commands",
"can",
"or",
"cannot",
"be",
"executed",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_reroute.go#L59-L62 | train |
olivere/elastic | cluster_reroute.go | RetryFailed | func (s *ClusterRerouteService) RetryFailed(retryFailed bool) *ClusterRerouteService {
s.retryFailed = &retryFailed
return s
} | go | func (s *ClusterRerouteService) RetryFailed(retryFailed bool) *ClusterRerouteService {
s.retryFailed = &retryFailed
return s
} | [
"func",
"(",
"s",
"*",
"ClusterRerouteService",
")",
"RetryFailed",
"(",
"retryFailed",
"bool",
")",
"*",
"ClusterRerouteService",
"{",
"s",
".",
"retryFailed",
"=",
"&",
"retryFailed",
"\n",
"return",
"s",
"\n",
"}"
] | // RetryFailed indicates whether to retry allocation of shards that are blocked
// due to too many subsequent allocation failures. | [
"RetryFailed",
"indicates",
"whether",
"to",
"retry",
"allocation",
"of",
"shards",
"that",
"are",
"blocked",
"due",
"to",
"too",
"many",
"subsequent",
"allocation",
"failures",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_reroute.go#L66-L69 | train |
olivere/elastic | cluster_reroute.go | MasterTimeout | func (s *ClusterRerouteService) MasterTimeout(masterTimeout string) *ClusterRerouteService {
s.masterTimeout = masterTimeout
return s
} | go | func (s *ClusterRerouteService) MasterTimeout(masterTimeout string) *ClusterRerouteService {
s.masterTimeout = masterTimeout
return s
} | [
"func",
"(",
"s",
"*",
"ClusterRerouteService",
")",
"MasterTimeout",
"(",
"masterTimeout",
"string",
")",
"*",
"ClusterRerouteService",
"{",
"s",
".",
"masterTimeout",
"=",
"masterTimeout",
"\n",
"return",
"s",
"\n",
"}"
] | // MasterTimeout specifies an explicit timeout for connection to master. | [
"MasterTimeout",
"specifies",
"an",
"explicit",
"timeout",
"for",
"connection",
"to",
"master",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_reroute.go#L72-L75 | train |
olivere/elastic | cluster_reroute.go | Timeout | func (s *ClusterRerouteService) Timeout(timeout string) *ClusterRerouteService {
s.timeout = timeout
return s
} | go | func (s *ClusterRerouteService) Timeout(timeout string) *ClusterRerouteService {
s.timeout = timeout
return s
} | [
"func",
"(",
"s",
"*",
"ClusterRerouteService",
")",
"Timeout",
"(",
"timeout",
"string",
")",
"*",
"ClusterRerouteService",
"{",
"s",
".",
"timeout",
"=",
"timeout",
"\n",
"return",
"s",
"\n",
"}"
] | // Timeout specifies an explicit operationtimeout. | [
"Timeout",
"specifies",
"an",
"explicit",
"operationtimeout",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_reroute.go#L78-L81 | train |
olivere/elastic | cluster_reroute.go | Add | func (s *ClusterRerouteService) Add(commands ...AllocationCommand) *ClusterRerouteService {
s.commands = append(s.commands, commands...)
return s
} | go | func (s *ClusterRerouteService) Add(commands ...AllocationCommand) *ClusterRerouteService {
s.commands = append(s.commands, commands...)
return s
} | [
"func",
"(",
"s",
"*",
"ClusterRerouteService",
")",
"Add",
"(",
"commands",
"...",
"AllocationCommand",
")",
"*",
"ClusterRerouteService",
"{",
"s",
".",
"commands",
"=",
"append",
"(",
"s",
".",
"commands",
",",
"commands",
"...",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // Add adds one or more commands to be executed. | [
"Add",
"adds",
"one",
"or",
"more",
"commands",
"to",
"be",
"executed",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_reroute.go#L90-L93 | train |
olivere/elastic | cluster_reroute.go | NewMoveAllocationCommand | func NewMoveAllocationCommand(index string, shardId int, fromNode, toNode string) *MoveAllocationCommand {
return &MoveAllocationCommand{
index: index,
shardId: shardId,
fromNode: fromNode,
toNode: toNode,
}
} | go | func NewMoveAllocationCommand(index string, shardId int, fromNode, toNode string) *MoveAllocationCommand {
return &MoveAllocationCommand{
index: index,
shardId: shardId,
fromNode: fromNode,
toNode: toNode,
}
} | [
"func",
"NewMoveAllocationCommand",
"(",
"index",
"string",
",",
"shardId",
"int",
",",
"fromNode",
",",
"toNode",
"string",
")",
"*",
"MoveAllocationCommand",
"{",
"return",
"&",
"MoveAllocationCommand",
"{",
"index",
":",
"index",
",",
"shardId",
":",
"shardId",
",",
"fromNode",
":",
"fromNode",
",",
"toNode",
":",
"toNode",
",",
"}",
"\n",
"}"
] | // NewMoveAllocationCommand creates a new MoveAllocationCommand. | [
"NewMoveAllocationCommand",
"creates",
"a",
"new",
"MoveAllocationCommand",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_reroute.go#L235-L242 | train |
olivere/elastic | cluster_reroute.go | NewCancelAllocationCommand | func NewCancelAllocationCommand(index string, shardId int, node string, allowPrimary bool) *CancelAllocationCommand {
return &CancelAllocationCommand{
index: index,
shardId: shardId,
node: node,
allowPrimary: allowPrimary,
}
} | go | func NewCancelAllocationCommand(index string, shardId int, node string, allowPrimary bool) *CancelAllocationCommand {
return &CancelAllocationCommand{
index: index,
shardId: shardId,
node: node,
allowPrimary: allowPrimary,
}
} | [
"func",
"NewCancelAllocationCommand",
"(",
"index",
"string",
",",
"shardId",
"int",
",",
"node",
"string",
",",
"allowPrimary",
"bool",
")",
"*",
"CancelAllocationCommand",
"{",
"return",
"&",
"CancelAllocationCommand",
"{",
"index",
":",
"index",
",",
"shardId",
":",
"shardId",
",",
"node",
":",
"node",
",",
"allowPrimary",
":",
"allowPrimary",
",",
"}",
"\n",
"}"
] | // NewCancelAllocationCommand creates a new CancelAllocationCommand. | [
"NewCancelAllocationCommand",
"creates",
"a",
"new",
"CancelAllocationCommand",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_reroute.go#L268-L275 | train |
olivere/elastic | cluster_reroute.go | NewAllocateStalePrimaryAllocationCommand | func NewAllocateStalePrimaryAllocationCommand(index string, shardId int, node string, acceptDataLoss bool) *AllocateStalePrimaryAllocationCommand {
return &AllocateStalePrimaryAllocationCommand{
index: index,
shardId: shardId,
node: node,
acceptDataLoss: acceptDataLoss,
}
} | go | func NewAllocateStalePrimaryAllocationCommand(index string, shardId int, node string, acceptDataLoss bool) *AllocateStalePrimaryAllocationCommand {
return &AllocateStalePrimaryAllocationCommand{
index: index,
shardId: shardId,
node: node,
acceptDataLoss: acceptDataLoss,
}
} | [
"func",
"NewAllocateStalePrimaryAllocationCommand",
"(",
"index",
"string",
",",
"shardId",
"int",
",",
"node",
"string",
",",
"acceptDataLoss",
"bool",
")",
"*",
"AllocateStalePrimaryAllocationCommand",
"{",
"return",
"&",
"AllocateStalePrimaryAllocationCommand",
"{",
"index",
":",
"index",
",",
"shardId",
":",
"shardId",
",",
"node",
":",
"node",
",",
"acceptDataLoss",
":",
"acceptDataLoss",
",",
"}",
"\n",
"}"
] | // NewAllocateStalePrimaryAllocationCommand creates a new
// AllocateStalePrimaryAllocationCommand. | [
"NewAllocateStalePrimaryAllocationCommand",
"creates",
"a",
"new",
"AllocateStalePrimaryAllocationCommand",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_reroute.go#L304-L311 | train |
olivere/elastic | cluster_reroute.go | NewAllocateReplicaAllocationCommand | func NewAllocateReplicaAllocationCommand(index string, shardId int, node string) *AllocateReplicaAllocationCommand {
return &AllocateReplicaAllocationCommand{
index: index,
shardId: shardId,
node: node,
}
} | go | func NewAllocateReplicaAllocationCommand(index string, shardId int, node string) *AllocateReplicaAllocationCommand {
return &AllocateReplicaAllocationCommand{
index: index,
shardId: shardId,
node: node,
}
} | [
"func",
"NewAllocateReplicaAllocationCommand",
"(",
"index",
"string",
",",
"shardId",
"int",
",",
"node",
"string",
")",
"*",
"AllocateReplicaAllocationCommand",
"{",
"return",
"&",
"AllocateReplicaAllocationCommand",
"{",
"index",
":",
"index",
",",
"shardId",
":",
"shardId",
",",
"node",
":",
"node",
",",
"}",
"\n",
"}"
] | // NewAllocateReplicaAllocationCommand creates a new
// AllocateReplicaAllocationCommand. | [
"NewAllocateReplicaAllocationCommand",
"creates",
"a",
"new",
"AllocateReplicaAllocationCommand",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_reroute.go#L338-L344 | train |
olivere/elastic | cluster_reroute.go | NewAllocateEmptyPrimaryAllocationCommand | func NewAllocateEmptyPrimaryAllocationCommand(index string, shardId int, node string, acceptDataLoss bool) *AllocateEmptyPrimaryAllocationCommand {
return &AllocateEmptyPrimaryAllocationCommand{
index: index,
shardId: shardId,
node: node,
acceptDataLoss: acceptDataLoss,
}
} | go | func NewAllocateEmptyPrimaryAllocationCommand(index string, shardId int, node string, acceptDataLoss bool) *AllocateEmptyPrimaryAllocationCommand {
return &AllocateEmptyPrimaryAllocationCommand{
index: index,
shardId: shardId,
node: node,
acceptDataLoss: acceptDataLoss,
}
} | [
"func",
"NewAllocateEmptyPrimaryAllocationCommand",
"(",
"index",
"string",
",",
"shardId",
"int",
",",
"node",
"string",
",",
"acceptDataLoss",
"bool",
")",
"*",
"AllocateEmptyPrimaryAllocationCommand",
"{",
"return",
"&",
"AllocateEmptyPrimaryAllocationCommand",
"{",
"index",
":",
"index",
",",
"shardId",
":",
"shardId",
",",
"node",
":",
"node",
",",
"acceptDataLoss",
":",
"acceptDataLoss",
",",
"}",
"\n",
"}"
] | // NewAllocateEmptyPrimaryAllocationCommand creates a new
// AllocateEmptyPrimaryAllocationCommand. | [
"NewAllocateEmptyPrimaryAllocationCommand",
"creates",
"a",
"new",
"AllocateEmptyPrimaryAllocationCommand",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/cluster_reroute.go#L370-L377 | train |
olivere/elastic | search_queries_more_like_this.go | NewMoreLikeThisQuery | func NewMoreLikeThisQuery() *MoreLikeThisQuery {
return &MoreLikeThisQuery{
fields: make([]string, 0),
stopWords: make([]string, 0),
docs: make([]*MoreLikeThisQueryItem, 0),
unlikeDocs: make([]*MoreLikeThisQueryItem, 0),
}
} | go | func NewMoreLikeThisQuery() *MoreLikeThisQuery {
return &MoreLikeThisQuery{
fields: make([]string, 0),
stopWords: make([]string, 0),
docs: make([]*MoreLikeThisQueryItem, 0),
unlikeDocs: make([]*MoreLikeThisQueryItem, 0),
}
} | [
"func",
"NewMoreLikeThisQuery",
"(",
")",
"*",
"MoreLikeThisQuery",
"{",
"return",
"&",
"MoreLikeThisQuery",
"{",
"fields",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"stopWords",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"docs",
":",
"make",
"(",
"[",
"]",
"*",
"MoreLikeThisQueryItem",
",",
"0",
")",
",",
"unlikeDocs",
":",
"make",
"(",
"[",
"]",
"*",
"MoreLikeThisQueryItem",
",",
"0",
")",
",",
"}",
"\n",
"}"
] | // NewMoreLikeThisQuery creates and initializes a new MoreLikeThisQuery. | [
"NewMoreLikeThisQuery",
"creates",
"and",
"initializes",
"a",
"new",
"MoreLikeThisQuery",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L38-L45 | train |
olivere/elastic | search_queries_more_like_this.go | Field | func (q *MoreLikeThisQuery) Field(fields ...string) *MoreLikeThisQuery {
q.fields = append(q.fields, fields...)
return q
} | go | func (q *MoreLikeThisQuery) Field(fields ...string) *MoreLikeThisQuery {
q.fields = append(q.fields, fields...)
return q
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"Field",
"(",
"fields",
"...",
"string",
")",
"*",
"MoreLikeThisQuery",
"{",
"q",
".",
"fields",
"=",
"append",
"(",
"q",
".",
"fields",
",",
"fields",
"...",
")",
"\n",
"return",
"q",
"\n",
"}"
] | // Field adds one or more field names to the query. | [
"Field",
"adds",
"one",
"or",
"more",
"field",
"names",
"to",
"the",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L48-L51 | train |
olivere/elastic | search_queries_more_like_this.go | StopWord | func (q *MoreLikeThisQuery) StopWord(stopWords ...string) *MoreLikeThisQuery {
q.stopWords = append(q.stopWords, stopWords...)
return q
} | go | func (q *MoreLikeThisQuery) StopWord(stopWords ...string) *MoreLikeThisQuery {
q.stopWords = append(q.stopWords, stopWords...)
return q
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"StopWord",
"(",
"stopWords",
"...",
"string",
")",
"*",
"MoreLikeThisQuery",
"{",
"q",
".",
"stopWords",
"=",
"append",
"(",
"q",
".",
"stopWords",
",",
"stopWords",
"...",
")",
"\n",
"return",
"q",
"\n",
"}"
] | // StopWord sets the stopwords. Any word in this set is considered
// "uninteresting" and ignored. Even if your Analyzer allows stopwords,
// you might want to tell the MoreLikeThis code to ignore them, as for
// the purposes of document similarity it seems reasonable to assume that
// "a stop word is never interesting". | [
"StopWord",
"sets",
"the",
"stopwords",
".",
"Any",
"word",
"in",
"this",
"set",
"is",
"considered",
"uninteresting",
"and",
"ignored",
".",
"Even",
"if",
"your",
"Analyzer",
"allows",
"stopwords",
"you",
"might",
"want",
"to",
"tell",
"the",
"MoreLikeThis",
"code",
"to",
"ignore",
"them",
"as",
"for",
"the",
"purposes",
"of",
"document",
"similarity",
"it",
"seems",
"reasonable",
"to",
"assume",
"that",
"a",
"stop",
"word",
"is",
"never",
"interesting",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L58-L61 | train |
olivere/elastic | search_queries_more_like_this.go | LikeItems | func (q *MoreLikeThisQuery) LikeItems(docs ...*MoreLikeThisQueryItem) *MoreLikeThisQuery {
q.docs = append(q.docs, docs...)
return q
} | go | func (q *MoreLikeThisQuery) LikeItems(docs ...*MoreLikeThisQueryItem) *MoreLikeThisQuery {
q.docs = append(q.docs, docs...)
return q
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"LikeItems",
"(",
"docs",
"...",
"*",
"MoreLikeThisQueryItem",
")",
"*",
"MoreLikeThisQuery",
"{",
"q",
".",
"docs",
"=",
"append",
"(",
"q",
".",
"docs",
",",
"docs",
"...",
")",
"\n",
"return",
"q",
"\n",
"}"
] | // LikeItems sets the documents to use in order to find documents that are "like" this. | [
"LikeItems",
"sets",
"the",
"documents",
"to",
"use",
"in",
"order",
"to",
"find",
"documents",
"that",
"are",
"like",
"this",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L73-L76 | train |
olivere/elastic | search_queries_more_like_this.go | IgnoreLikeText | func (q *MoreLikeThisQuery) IgnoreLikeText(ignoreLikeText ...string) *MoreLikeThisQuery {
for _, s := range ignoreLikeText {
item := NewMoreLikeThisQueryItem().LikeText(s)
q.unlikeDocs = append(q.unlikeDocs, item)
}
return q
} | go | func (q *MoreLikeThisQuery) IgnoreLikeText(ignoreLikeText ...string) *MoreLikeThisQuery {
for _, s := range ignoreLikeText {
item := NewMoreLikeThisQueryItem().LikeText(s)
q.unlikeDocs = append(q.unlikeDocs, item)
}
return q
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"IgnoreLikeText",
"(",
"ignoreLikeText",
"...",
"string",
")",
"*",
"MoreLikeThisQuery",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"ignoreLikeText",
"{",
"item",
":=",
"NewMoreLikeThisQueryItem",
"(",
")",
".",
"LikeText",
"(",
"s",
")",
"\n",
"q",
".",
"unlikeDocs",
"=",
"append",
"(",
"q",
".",
"unlikeDocs",
",",
"item",
")",
"\n",
"}",
"\n",
"return",
"q",
"\n",
"}"
] | // IgnoreLikeText sets the text from which the terms should not be selected from. | [
"IgnoreLikeText",
"sets",
"the",
"text",
"from",
"which",
"the",
"terms",
"should",
"not",
"be",
"selected",
"from",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L79-L85 | train |
olivere/elastic | search_queries_more_like_this.go | IgnoreLikeItems | func (q *MoreLikeThisQuery) IgnoreLikeItems(ignoreDocs ...*MoreLikeThisQueryItem) *MoreLikeThisQuery {
q.unlikeDocs = append(q.unlikeDocs, ignoreDocs...)
return q
} | go | func (q *MoreLikeThisQuery) IgnoreLikeItems(ignoreDocs ...*MoreLikeThisQueryItem) *MoreLikeThisQuery {
q.unlikeDocs = append(q.unlikeDocs, ignoreDocs...)
return q
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"IgnoreLikeItems",
"(",
"ignoreDocs",
"...",
"*",
"MoreLikeThisQueryItem",
")",
"*",
"MoreLikeThisQuery",
"{",
"q",
".",
"unlikeDocs",
"=",
"append",
"(",
"q",
".",
"unlikeDocs",
",",
"ignoreDocs",
"...",
")",
"\n",
"return",
"q",
"\n",
"}"
] | // IgnoreLikeItems sets the documents from which the terms should not be selected from. | [
"IgnoreLikeItems",
"sets",
"the",
"documents",
"from",
"which",
"the",
"terms",
"should",
"not",
"be",
"selected",
"from",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L88-L91 | train |
olivere/elastic | search_queries_more_like_this.go | Include | func (q *MoreLikeThisQuery) Include(include bool) *MoreLikeThisQuery {
q.include = &include
return q
} | go | func (q *MoreLikeThisQuery) Include(include bool) *MoreLikeThisQuery {
q.include = &include
return q
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"Include",
"(",
"include",
"bool",
")",
"*",
"MoreLikeThisQuery",
"{",
"q",
".",
"include",
"=",
"&",
"include",
"\n",
"return",
"q",
"\n",
"}"
] | // Include specifies whether the input documents should also be included
// in the results returned. Defaults to false. | [
"Include",
"specifies",
"whether",
"the",
"input",
"documents",
"should",
"also",
"be",
"included",
"in",
"the",
"results",
"returned",
".",
"Defaults",
"to",
"false",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L104-L107 | train |
olivere/elastic | search_queries_more_like_this.go | MinimumShouldMatch | func (q *MoreLikeThisQuery) MinimumShouldMatch(minimumShouldMatch string) *MoreLikeThisQuery {
q.minimumShouldMatch = minimumShouldMatch
return q
} | go | func (q *MoreLikeThisQuery) MinimumShouldMatch(minimumShouldMatch string) *MoreLikeThisQuery {
q.minimumShouldMatch = minimumShouldMatch
return q
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"MinimumShouldMatch",
"(",
"minimumShouldMatch",
"string",
")",
"*",
"MoreLikeThisQuery",
"{",
"q",
".",
"minimumShouldMatch",
"=",
"minimumShouldMatch",
"\n",
"return",
"q",
"\n",
"}"
] | // MinimumShouldMatch sets the number of terms that must match the generated
// query expressed in the common syntax for minimum should match.
// The default value is "30%".
//
// This used to be "PercentTermsToMatch" in Elasticsearch versions before 2.0. | [
"MinimumShouldMatch",
"sets",
"the",
"number",
"of",
"terms",
"that",
"must",
"match",
"the",
"generated",
"query",
"expressed",
"in",
"the",
"common",
"syntax",
"for",
"minimum",
"should",
"match",
".",
"The",
"default",
"value",
"is",
"30%",
".",
"This",
"used",
"to",
"be",
"PercentTermsToMatch",
"in",
"Elasticsearch",
"versions",
"before",
"2",
".",
"0",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L114-L117 | train |
olivere/elastic | search_queries_more_like_this.go | MinTermFreq | func (q *MoreLikeThisQuery) MinTermFreq(minTermFreq int) *MoreLikeThisQuery {
q.minTermFreq = &minTermFreq
return q
} | go | func (q *MoreLikeThisQuery) MinTermFreq(minTermFreq int) *MoreLikeThisQuery {
q.minTermFreq = &minTermFreq
return q
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"MinTermFreq",
"(",
"minTermFreq",
"int",
")",
"*",
"MoreLikeThisQuery",
"{",
"q",
".",
"minTermFreq",
"=",
"&",
"minTermFreq",
"\n",
"return",
"q",
"\n",
"}"
] | // MinTermFreq is the frequency below which terms will be ignored in the
// source doc. The default frequency is 2. | [
"MinTermFreq",
"is",
"the",
"frequency",
"below",
"which",
"terms",
"will",
"be",
"ignored",
"in",
"the",
"source",
"doc",
".",
"The",
"default",
"frequency",
"is",
"2",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L121-L124 | train |
olivere/elastic | search_queries_more_like_this.go | MaxQueryTerms | func (q *MoreLikeThisQuery) MaxQueryTerms(maxQueryTerms int) *MoreLikeThisQuery {
q.maxQueryTerms = &maxQueryTerms
return q
} | go | func (q *MoreLikeThisQuery) MaxQueryTerms(maxQueryTerms int) *MoreLikeThisQuery {
q.maxQueryTerms = &maxQueryTerms
return q
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"MaxQueryTerms",
"(",
"maxQueryTerms",
"int",
")",
"*",
"MoreLikeThisQuery",
"{",
"q",
".",
"maxQueryTerms",
"=",
"&",
"maxQueryTerms",
"\n",
"return",
"q",
"\n",
"}"
] | // MaxQueryTerms sets the maximum number of query terms that will be included
// in any generated query. It defaults to 25. | [
"MaxQueryTerms",
"sets",
"the",
"maximum",
"number",
"of",
"query",
"terms",
"that",
"will",
"be",
"included",
"in",
"any",
"generated",
"query",
".",
"It",
"defaults",
"to",
"25",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L128-L131 | train |
olivere/elastic | search_queries_more_like_this.go | BoostTerms | func (q *MoreLikeThisQuery) BoostTerms(boostTerms float64) *MoreLikeThisQuery {
q.boostTerms = &boostTerms
return q
} | go | func (q *MoreLikeThisQuery) BoostTerms(boostTerms float64) *MoreLikeThisQuery {
q.boostTerms = &boostTerms
return q
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"BoostTerms",
"(",
"boostTerms",
"float64",
")",
"*",
"MoreLikeThisQuery",
"{",
"q",
".",
"boostTerms",
"=",
"&",
"boostTerms",
"\n",
"return",
"q",
"\n",
"}"
] | // BoostTerms sets the boost factor to use when boosting terms.
// It defaults to 1. | [
"BoostTerms",
"sets",
"the",
"boost",
"factor",
"to",
"use",
"when",
"boosting",
"terms",
".",
"It",
"defaults",
"to",
"1",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L164-L167 | train |
olivere/elastic | search_queries_more_like_this.go | Analyzer | func (q *MoreLikeThisQuery) Analyzer(analyzer string) *MoreLikeThisQuery {
q.analyzer = analyzer
return q
} | go | func (q *MoreLikeThisQuery) Analyzer(analyzer string) *MoreLikeThisQuery {
q.analyzer = analyzer
return q
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"Analyzer",
"(",
"analyzer",
"string",
")",
"*",
"MoreLikeThisQuery",
"{",
"q",
".",
"analyzer",
"=",
"analyzer",
"\n",
"return",
"q",
"\n",
"}"
] | // Analyzer specifies the analyzer that will be use to analyze the text.
// Defaults to the analyzer associated with the field. | [
"Analyzer",
"specifies",
"the",
"analyzer",
"that",
"will",
"be",
"use",
"to",
"analyze",
"the",
"text",
".",
"Defaults",
"to",
"the",
"analyzer",
"associated",
"with",
"the",
"field",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L171-L174 | train |
olivere/elastic | search_queries_more_like_this.go | Source | func (q *MoreLikeThisQuery) Source() (interface{}, error) {
// {
// "match_all" : { ... }
// }
if len(q.docs) == 0 {
return nil, errors.New(`more_like_this requires some documents to be "liked"`)
}
source := make(map[string]interface{})
params := make(map[string]interface{})
source["more_like_this"] = params
if len(q.fields) > 0 {
params["fields"] = q.fields
}
var likes []interface{}
for _, doc := range q.docs {
src, err := doc.Source()
if err != nil {
return nil, err
}
likes = append(likes, src)
}
params["like"] = likes
if len(q.unlikeDocs) > 0 {
var dontLikes []interface{}
for _, doc := range q.unlikeDocs {
src, err := doc.Source()
if err != nil {
return nil, err
}
dontLikes = append(dontLikes, src)
}
params["unlike"] = dontLikes
}
if q.minimumShouldMatch != "" {
params["minimum_should_match"] = q.minimumShouldMatch
}
if q.minTermFreq != nil {
params["min_term_freq"] = *q.minTermFreq
}
if q.maxQueryTerms != nil {
params["max_query_terms"] = *q.maxQueryTerms
}
if len(q.stopWords) > 0 {
params["stop_words"] = q.stopWords
}
if q.minDocFreq != nil {
params["min_doc_freq"] = *q.minDocFreq
}
if q.maxDocFreq != nil {
params["max_doc_freq"] = *q.maxDocFreq
}
if q.minWordLength != nil {
params["min_word_length"] = *q.minWordLength
}
if q.maxWordLength != nil {
params["max_word_length"] = *q.maxWordLength
}
if q.boostTerms != nil {
params["boost_terms"] = *q.boostTerms
}
if q.boost != nil {
params["boost"] = *q.boost
}
if q.analyzer != "" {
params["analyzer"] = q.analyzer
}
if q.failOnUnsupportedField != nil {
params["fail_on_unsupported_field"] = *q.failOnUnsupportedField
}
if q.queryName != "" {
params["_name"] = q.queryName
}
if q.include != nil {
params["include"] = *q.include
}
return source, nil
} | go | func (q *MoreLikeThisQuery) Source() (interface{}, error) {
// {
// "match_all" : { ... }
// }
if len(q.docs) == 0 {
return nil, errors.New(`more_like_this requires some documents to be "liked"`)
}
source := make(map[string]interface{})
params := make(map[string]interface{})
source["more_like_this"] = params
if len(q.fields) > 0 {
params["fields"] = q.fields
}
var likes []interface{}
for _, doc := range q.docs {
src, err := doc.Source()
if err != nil {
return nil, err
}
likes = append(likes, src)
}
params["like"] = likes
if len(q.unlikeDocs) > 0 {
var dontLikes []interface{}
for _, doc := range q.unlikeDocs {
src, err := doc.Source()
if err != nil {
return nil, err
}
dontLikes = append(dontLikes, src)
}
params["unlike"] = dontLikes
}
if q.minimumShouldMatch != "" {
params["minimum_should_match"] = q.minimumShouldMatch
}
if q.minTermFreq != nil {
params["min_term_freq"] = *q.minTermFreq
}
if q.maxQueryTerms != nil {
params["max_query_terms"] = *q.maxQueryTerms
}
if len(q.stopWords) > 0 {
params["stop_words"] = q.stopWords
}
if q.minDocFreq != nil {
params["min_doc_freq"] = *q.minDocFreq
}
if q.maxDocFreq != nil {
params["max_doc_freq"] = *q.maxDocFreq
}
if q.minWordLength != nil {
params["min_word_length"] = *q.minWordLength
}
if q.maxWordLength != nil {
params["max_word_length"] = *q.maxWordLength
}
if q.boostTerms != nil {
params["boost_terms"] = *q.boostTerms
}
if q.boost != nil {
params["boost"] = *q.boost
}
if q.analyzer != "" {
params["analyzer"] = q.analyzer
}
if q.failOnUnsupportedField != nil {
params["fail_on_unsupported_field"] = *q.failOnUnsupportedField
}
if q.queryName != "" {
params["_name"] = q.queryName
}
if q.include != nil {
params["include"] = *q.include
}
return source, nil
} | [
"func",
"(",
"q",
"*",
"MoreLikeThisQuery",
")",
"Source",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// {",
"// \"match_all\" : { ... }",
"// }",
"if",
"len",
"(",
"q",
".",
"docs",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"`more_like_this requires some documents to be \"liked\"`",
")",
"\n",
"}",
"\n\n",
"source",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n\n",
"params",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"source",
"[",
"\"",
"\"",
"]",
"=",
"params",
"\n\n",
"if",
"len",
"(",
"q",
".",
"fields",
")",
">",
"0",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"fields",
"\n",
"}",
"\n\n",
"var",
"likes",
"[",
"]",
"interface",
"{",
"}",
"\n",
"for",
"_",
",",
"doc",
":=",
"range",
"q",
".",
"docs",
"{",
"src",
",",
"err",
":=",
"doc",
".",
"Source",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"likes",
"=",
"append",
"(",
"likes",
",",
"src",
")",
"\n",
"}",
"\n",
"params",
"[",
"\"",
"\"",
"]",
"=",
"likes",
"\n\n",
"if",
"len",
"(",
"q",
".",
"unlikeDocs",
")",
">",
"0",
"{",
"var",
"dontLikes",
"[",
"]",
"interface",
"{",
"}",
"\n",
"for",
"_",
",",
"doc",
":=",
"range",
"q",
".",
"unlikeDocs",
"{",
"src",
",",
"err",
":=",
"doc",
".",
"Source",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"dontLikes",
"=",
"append",
"(",
"dontLikes",
",",
"src",
")",
"\n",
"}",
"\n",
"params",
"[",
"\"",
"\"",
"]",
"=",
"dontLikes",
"\n",
"}",
"\n\n",
"if",
"q",
".",
"minimumShouldMatch",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"minimumShouldMatch",
"\n",
"}",
"\n",
"if",
"q",
".",
"minTermFreq",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"minTermFreq",
"\n",
"}",
"\n",
"if",
"q",
".",
"maxQueryTerms",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"maxQueryTerms",
"\n",
"}",
"\n",
"if",
"len",
"(",
"q",
".",
"stopWords",
")",
">",
"0",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"stopWords",
"\n",
"}",
"\n",
"if",
"q",
".",
"minDocFreq",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"minDocFreq",
"\n",
"}",
"\n",
"if",
"q",
".",
"maxDocFreq",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"maxDocFreq",
"\n",
"}",
"\n",
"if",
"q",
".",
"minWordLength",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"minWordLength",
"\n",
"}",
"\n",
"if",
"q",
".",
"maxWordLength",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"maxWordLength",
"\n",
"}",
"\n",
"if",
"q",
".",
"boostTerms",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"boostTerms",
"\n",
"}",
"\n",
"if",
"q",
".",
"boost",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"boost",
"\n",
"}",
"\n",
"if",
"q",
".",
"analyzer",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"analyzer",
"\n",
"}",
"\n",
"if",
"q",
".",
"failOnUnsupportedField",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"failOnUnsupportedField",
"\n",
"}",
"\n",
"if",
"q",
".",
"queryName",
"!=",
"\"",
"\"",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"q",
".",
"queryName",
"\n",
"}",
"\n",
"if",
"q",
".",
"include",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"include",
"\n",
"}",
"\n\n",
"return",
"source",
",",
"nil",
"\n",
"}"
] | // Source creates the source for the MLT query.
// It may return an error if the caller forgot to specify any documents to
// be "liked" in the MoreLikeThisQuery. | [
"Source",
"creates",
"the",
"source",
"for",
"the",
"MLT",
"query",
".",
"It",
"may",
"return",
"an",
"error",
"if",
"the",
"caller",
"forgot",
"to",
"specify",
"any",
"documents",
"to",
"be",
"liked",
"in",
"the",
"MoreLikeThisQuery",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L200-L283 | train |
olivere/elastic | search_queries_more_like_this.go | LikeText | func (item *MoreLikeThisQueryItem) LikeText(likeText string) *MoreLikeThisQueryItem {
item.likeText = likeText
return item
} | go | func (item *MoreLikeThisQueryItem) LikeText(likeText string) *MoreLikeThisQueryItem {
item.likeText = likeText
return item
} | [
"func",
"(",
"item",
"*",
"MoreLikeThisQueryItem",
")",
"LikeText",
"(",
"likeText",
"string",
")",
"*",
"MoreLikeThisQueryItem",
"{",
"item",
".",
"likeText",
"=",
"likeText",
"\n",
"return",
"item",
"\n",
"}"
] | // LikeText represents a text to be "liked". | [
"LikeText",
"represents",
"a",
"text",
"to",
"be",
"liked",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L311-L314 | train |
olivere/elastic | search_queries_more_like_this.go | Index | func (item *MoreLikeThisQueryItem) Index(index string) *MoreLikeThisQueryItem {
item.index = index
return item
} | go | func (item *MoreLikeThisQueryItem) Index(index string) *MoreLikeThisQueryItem {
item.index = index
return item
} | [
"func",
"(",
"item",
"*",
"MoreLikeThisQueryItem",
")",
"Index",
"(",
"index",
"string",
")",
"*",
"MoreLikeThisQueryItem",
"{",
"item",
".",
"index",
"=",
"index",
"\n",
"return",
"item",
"\n",
"}"
] | // Index represents the index of the item. | [
"Index",
"represents",
"the",
"index",
"of",
"the",
"item",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L317-L320 | train |
olivere/elastic | search_queries_more_like_this.go | Id | func (item *MoreLikeThisQueryItem) Id(id string) *MoreLikeThisQueryItem {
item.id = id
return item
} | go | func (item *MoreLikeThisQueryItem) Id(id string) *MoreLikeThisQueryItem {
item.id = id
return item
} | [
"func",
"(",
"item",
"*",
"MoreLikeThisQueryItem",
")",
"Id",
"(",
"id",
"string",
")",
"*",
"MoreLikeThisQueryItem",
"{",
"item",
".",
"id",
"=",
"id",
"\n",
"return",
"item",
"\n",
"}"
] | // Id represents the document id of the item. | [
"Id",
"represents",
"the",
"document",
"id",
"of",
"the",
"item",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L331-L334 | train |
olivere/elastic | search_queries_more_like_this.go | Fields | func (item *MoreLikeThisQueryItem) Fields(fields ...string) *MoreLikeThisQueryItem {
item.fields = append(item.fields, fields...)
return item
} | go | func (item *MoreLikeThisQueryItem) Fields(fields ...string) *MoreLikeThisQueryItem {
item.fields = append(item.fields, fields...)
return item
} | [
"func",
"(",
"item",
"*",
"MoreLikeThisQueryItem",
")",
"Fields",
"(",
"fields",
"...",
"string",
")",
"*",
"MoreLikeThisQueryItem",
"{",
"item",
".",
"fields",
"=",
"append",
"(",
"item",
".",
"fields",
",",
"fields",
"...",
")",
"\n",
"return",
"item",
"\n",
"}"
] | // Fields represents the list of fields of the item. | [
"Fields",
"represents",
"the",
"list",
"of",
"fields",
"of",
"the",
"item",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L343-L346 | train |
olivere/elastic | search_queries_more_like_this.go | Routing | func (item *MoreLikeThisQueryItem) Routing(routing string) *MoreLikeThisQueryItem {
item.routing = routing
return item
} | go | func (item *MoreLikeThisQueryItem) Routing(routing string) *MoreLikeThisQueryItem {
item.routing = routing
return item
} | [
"func",
"(",
"item",
"*",
"MoreLikeThisQueryItem",
")",
"Routing",
"(",
"routing",
"string",
")",
"*",
"MoreLikeThisQueryItem",
"{",
"item",
".",
"routing",
"=",
"routing",
"\n",
"return",
"item",
"\n",
"}"
] | // Routing sets the routing associated with the item. | [
"Routing",
"sets",
"the",
"routing",
"associated",
"with",
"the",
"item",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L349-L352 | train |
olivere/elastic | search_queries_more_like_this.go | FetchSourceContext | func (item *MoreLikeThisQueryItem) FetchSourceContext(fsc *FetchSourceContext) *MoreLikeThisQueryItem {
item.fsc = fsc
return item
} | go | func (item *MoreLikeThisQueryItem) FetchSourceContext(fsc *FetchSourceContext) *MoreLikeThisQueryItem {
item.fsc = fsc
return item
} | [
"func",
"(",
"item",
"*",
"MoreLikeThisQueryItem",
")",
"FetchSourceContext",
"(",
"fsc",
"*",
"FetchSourceContext",
")",
"*",
"MoreLikeThisQueryItem",
"{",
"item",
".",
"fsc",
"=",
"fsc",
"\n",
"return",
"item",
"\n",
"}"
] | // FetchSourceContext represents the fetch source of the item which controls
// if and how _source should be returned. | [
"FetchSourceContext",
"represents",
"the",
"fetch",
"source",
"of",
"the",
"item",
"which",
"controls",
"if",
"and",
"how",
"_source",
"should",
"be",
"returned",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L356-L359 | train |
olivere/elastic | search_queries_more_like_this.go | Version | func (item *MoreLikeThisQueryItem) Version(version int64) *MoreLikeThisQueryItem {
item.version = version
return item
} | go | func (item *MoreLikeThisQueryItem) Version(version int64) *MoreLikeThisQueryItem {
item.version = version
return item
} | [
"func",
"(",
"item",
"*",
"MoreLikeThisQueryItem",
")",
"Version",
"(",
"version",
"int64",
")",
"*",
"MoreLikeThisQueryItem",
"{",
"item",
".",
"version",
"=",
"version",
"\n",
"return",
"item",
"\n",
"}"
] | // Version specifies the version of the item. | [
"Version",
"specifies",
"the",
"version",
"of",
"the",
"item",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L362-L365 | train |
olivere/elastic | search_queries_more_like_this.go | VersionType | func (item *MoreLikeThisQueryItem) VersionType(versionType string) *MoreLikeThisQueryItem {
item.versionType = versionType
return item
} | go | func (item *MoreLikeThisQueryItem) VersionType(versionType string) *MoreLikeThisQueryItem {
item.versionType = versionType
return item
} | [
"func",
"(",
"item",
"*",
"MoreLikeThisQueryItem",
")",
"VersionType",
"(",
"versionType",
"string",
")",
"*",
"MoreLikeThisQueryItem",
"{",
"item",
".",
"versionType",
"=",
"versionType",
"\n",
"return",
"item",
"\n",
"}"
] | // VersionType represents the version type of the item. | [
"VersionType",
"represents",
"the",
"version",
"type",
"of",
"the",
"item",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L368-L371 | train |
olivere/elastic | search_queries_more_like_this.go | Source | func (item *MoreLikeThisQueryItem) Source() (interface{}, error) {
if item.likeText != "" {
return item.likeText, nil
}
source := make(map[string]interface{})
if item.index != "" {
source["_index"] = item.index
}
if item.typ != "" {
source["_type"] = item.typ
}
if item.id != "" {
source["_id"] = item.id
}
if item.doc != nil {
source["doc"] = item.doc
}
if len(item.fields) > 0 {
source["fields"] = item.fields
}
if item.routing != "" {
source["_routing"] = item.routing
}
if item.fsc != nil {
src, err := item.fsc.Source()
if err != nil {
return nil, err
}
source["_source"] = src
}
if item.version >= 0 {
source["_version"] = item.version
}
if item.versionType != "" {
source["_version_type"] = item.versionType
}
return source, nil
} | go | func (item *MoreLikeThisQueryItem) Source() (interface{}, error) {
if item.likeText != "" {
return item.likeText, nil
}
source := make(map[string]interface{})
if item.index != "" {
source["_index"] = item.index
}
if item.typ != "" {
source["_type"] = item.typ
}
if item.id != "" {
source["_id"] = item.id
}
if item.doc != nil {
source["doc"] = item.doc
}
if len(item.fields) > 0 {
source["fields"] = item.fields
}
if item.routing != "" {
source["_routing"] = item.routing
}
if item.fsc != nil {
src, err := item.fsc.Source()
if err != nil {
return nil, err
}
source["_source"] = src
}
if item.version >= 0 {
source["_version"] = item.version
}
if item.versionType != "" {
source["_version_type"] = item.versionType
}
return source, nil
} | [
"func",
"(",
"item",
"*",
"MoreLikeThisQueryItem",
")",
"Source",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"item",
".",
"likeText",
"!=",
"\"",
"\"",
"{",
"return",
"item",
".",
"likeText",
",",
"nil",
"\n",
"}",
"\n\n",
"source",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n\n",
"if",
"item",
".",
"index",
"!=",
"\"",
"\"",
"{",
"source",
"[",
"\"",
"\"",
"]",
"=",
"item",
".",
"index",
"\n",
"}",
"\n",
"if",
"item",
".",
"typ",
"!=",
"\"",
"\"",
"{",
"source",
"[",
"\"",
"\"",
"]",
"=",
"item",
".",
"typ",
"\n",
"}",
"\n",
"if",
"item",
".",
"id",
"!=",
"\"",
"\"",
"{",
"source",
"[",
"\"",
"\"",
"]",
"=",
"item",
".",
"id",
"\n",
"}",
"\n",
"if",
"item",
".",
"doc",
"!=",
"nil",
"{",
"source",
"[",
"\"",
"\"",
"]",
"=",
"item",
".",
"doc",
"\n",
"}",
"\n",
"if",
"len",
"(",
"item",
".",
"fields",
")",
">",
"0",
"{",
"source",
"[",
"\"",
"\"",
"]",
"=",
"item",
".",
"fields",
"\n",
"}",
"\n",
"if",
"item",
".",
"routing",
"!=",
"\"",
"\"",
"{",
"source",
"[",
"\"",
"\"",
"]",
"=",
"item",
".",
"routing",
"\n",
"}",
"\n",
"if",
"item",
".",
"fsc",
"!=",
"nil",
"{",
"src",
",",
"err",
":=",
"item",
".",
"fsc",
".",
"Source",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"source",
"[",
"\"",
"\"",
"]",
"=",
"src",
"\n",
"}",
"\n",
"if",
"item",
".",
"version",
">=",
"0",
"{",
"source",
"[",
"\"",
"\"",
"]",
"=",
"item",
".",
"version",
"\n",
"}",
"\n",
"if",
"item",
".",
"versionType",
"!=",
"\"",
"\"",
"{",
"source",
"[",
"\"",
"\"",
"]",
"=",
"item",
".",
"versionType",
"\n",
"}",
"\n\n",
"return",
"source",
",",
"nil",
"\n",
"}"
] | // Source returns the JSON-serializable fragment of the entity. | [
"Source",
"returns",
"the",
"JSON",
"-",
"serializable",
"fragment",
"of",
"the",
"entity",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_more_like_this.go#L374-L414 | train |
olivere/elastic | indices_refresh.go | Index | func (s *RefreshService) Index(index ...string) *RefreshService {
s.index = append(s.index, index...)
return s
} | go | func (s *RefreshService) Index(index ...string) *RefreshService {
s.index = append(s.index, index...)
return s
} | [
"func",
"(",
"s",
"*",
"RefreshService",
")",
"Index",
"(",
"index",
"...",
"string",
")",
"*",
"RefreshService",
"{",
"s",
".",
"index",
"=",
"append",
"(",
"s",
".",
"index",
",",
"index",
"...",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // Index specifies the indices to refresh. | [
"Index",
"specifies",
"the",
"indices",
"to",
"refresh",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_refresh.go#L33-L36 | train |
olivere/elastic | indices_refresh.go | Pretty | func (s *RefreshService) Pretty(pretty bool) *RefreshService {
s.pretty = pretty
return s
} | go | func (s *RefreshService) Pretty(pretty bool) *RefreshService {
s.pretty = pretty
return s
} | [
"func",
"(",
"s",
"*",
"RefreshService",
")",
"Pretty",
"(",
"pretty",
"bool",
")",
"*",
"RefreshService",
"{",
"s",
".",
"pretty",
"=",
"pretty",
"\n",
"return",
"s",
"\n",
"}"
] | // Pretty asks Elasticsearch to return indented JSON. | [
"Pretty",
"asks",
"Elasticsearch",
"to",
"return",
"indented",
"JSON",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_refresh.go#L39-L42 | train |
olivere/elastic | search_aggs_bucket_composite.go | NewCompositeAggregation | func NewCompositeAggregation() *CompositeAggregation {
return &CompositeAggregation{
sources: make([]CompositeAggregationValuesSource, 0),
subAggregations: make(map[string]Aggregation),
}
} | go | func NewCompositeAggregation() *CompositeAggregation {
return &CompositeAggregation{
sources: make([]CompositeAggregationValuesSource, 0),
subAggregations: make(map[string]Aggregation),
}
} | [
"func",
"NewCompositeAggregation",
"(",
")",
"*",
"CompositeAggregation",
"{",
"return",
"&",
"CompositeAggregation",
"{",
"sources",
":",
"make",
"(",
"[",
"]",
"CompositeAggregationValuesSource",
",",
"0",
")",
",",
"subAggregations",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"Aggregation",
")",
",",
"}",
"\n",
"}"
] | // NewCompositeAggregation creates a new CompositeAggregation. | [
"NewCompositeAggregation",
"creates",
"a",
"new",
"CompositeAggregation",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_composite.go#L21-L26 | train |
olivere/elastic | search_aggs_bucket_composite.go | Size | func (a *CompositeAggregation) Size(size int) *CompositeAggregation {
a.size = &size
return a
} | go | func (a *CompositeAggregation) Size(size int) *CompositeAggregation {
a.size = &size
return a
} | [
"func",
"(",
"a",
"*",
"CompositeAggregation",
")",
"Size",
"(",
"size",
"int",
")",
"*",
"CompositeAggregation",
"{",
"a",
".",
"size",
"=",
"&",
"size",
"\n",
"return",
"a",
"\n",
"}"
] | // Size represents the number of composite buckets to return.
// Defaults to 10 as of Elasticsearch 6.1. | [
"Size",
"represents",
"the",
"number",
"of",
"composite",
"buckets",
"to",
"return",
".",
"Defaults",
"to",
"10",
"as",
"of",
"Elasticsearch",
"6",
".",
"1",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_composite.go#L30-L33 | train |
olivere/elastic | search_aggs_bucket_composite.go | AggregateAfter | func (a *CompositeAggregation) AggregateAfter(after map[string]interface{}) *CompositeAggregation {
a.after = after
return a
} | go | func (a *CompositeAggregation) AggregateAfter(after map[string]interface{}) *CompositeAggregation {
a.after = after
return a
} | [
"func",
"(",
"a",
"*",
"CompositeAggregation",
")",
"AggregateAfter",
"(",
"after",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"*",
"CompositeAggregation",
"{",
"a",
".",
"after",
"=",
"after",
"\n",
"return",
"a",
"\n",
"}"
] | // AggregateAfter sets the values that indicate which composite bucket this
// request should "aggregate after". | [
"AggregateAfter",
"sets",
"the",
"values",
"that",
"indicate",
"which",
"composite",
"bucket",
"this",
"request",
"should",
"aggregate",
"after",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_composite.go#L37-L40 | train |
olivere/elastic | search_aggs_bucket_composite.go | Sources | func (a *CompositeAggregation) Sources(sources ...CompositeAggregationValuesSource) *CompositeAggregation {
a.sources = append(a.sources, sources...)
return a
} | go | func (a *CompositeAggregation) Sources(sources ...CompositeAggregationValuesSource) *CompositeAggregation {
a.sources = append(a.sources, sources...)
return a
} | [
"func",
"(",
"a",
"*",
"CompositeAggregation",
")",
"Sources",
"(",
"sources",
"...",
"CompositeAggregationValuesSource",
")",
"*",
"CompositeAggregation",
"{",
"a",
".",
"sources",
"=",
"append",
"(",
"a",
".",
"sources",
",",
"sources",
"...",
")",
"\n",
"return",
"a",
"\n",
"}"
] | // Sources specifies the list of CompositeAggregationValuesSource instances to
// use in the aggregation. | [
"Sources",
"specifies",
"the",
"list",
"of",
"CompositeAggregationValuesSource",
"instances",
"to",
"use",
"in",
"the",
"aggregation",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_composite.go#L44-L47 | train |
olivere/elastic | search_aggs_bucket_composite.go | SubAggregation | func (a *CompositeAggregation) SubAggregation(name string, subAggregation Aggregation) *CompositeAggregation {
a.subAggregations[name] = subAggregation
return a
} | go | func (a *CompositeAggregation) SubAggregation(name string, subAggregation Aggregation) *CompositeAggregation {
a.subAggregations[name] = subAggregation
return a
} | [
"func",
"(",
"a",
"*",
"CompositeAggregation",
")",
"SubAggregation",
"(",
"name",
"string",
",",
"subAggregation",
"Aggregation",
")",
"*",
"CompositeAggregation",
"{",
"a",
".",
"subAggregations",
"[",
"name",
"]",
"=",
"subAggregation",
"\n",
"return",
"a",
"\n",
"}"
] | // SubAggregations of this aggregation. | [
"SubAggregations",
"of",
"this",
"aggregation",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_composite.go#L50-L53 | train |
olivere/elastic | search_aggs_bucket_composite.go | Source | func (a *CompositeAggregation) Source() (interface{}, error) {
// Example:
// {
// "aggs" : {
// "my_composite_agg" : {
// "composite" : {
// "sources": [
// {"my_term": { "terms": { "field": "product" }}},
// {"my_histo": { "histogram": { "field": "price", "interval": 5 }}},
// {"my_date": { "date_histogram": { "field": "timestamp", "interval": "1d" }}},
// ],
// "size" : 10,
// "after" : ["a", 2, "c"]
// }
// }
// }
// }
//
// This method returns only the { "histogram" : { ... } } part.
source := make(map[string]interface{})
opts := make(map[string]interface{})
source["composite"] = opts
sources := make([]interface{}, len(a.sources))
for i, s := range a.sources {
src, err := s.Source()
if err != nil {
return nil, err
}
sources[i] = src
}
opts["sources"] = sources
if a.size != nil {
opts["size"] = *a.size
}
if a.after != nil {
opts["after"] = a.after
}
// AggregationBuilder (SubAggregations)
if len(a.subAggregations) > 0 {
aggsMap := make(map[string]interface{})
source["aggregations"] = aggsMap
for name, aggregate := range a.subAggregations {
src, err := aggregate.Source()
if err != nil {
return nil, err
}
aggsMap[name] = src
}
}
// Add Meta data if available
if len(a.meta) > 0 {
source["meta"] = a.meta
}
return source, nil
} | go | func (a *CompositeAggregation) Source() (interface{}, error) {
// Example:
// {
// "aggs" : {
// "my_composite_agg" : {
// "composite" : {
// "sources": [
// {"my_term": { "terms": { "field": "product" }}},
// {"my_histo": { "histogram": { "field": "price", "interval": 5 }}},
// {"my_date": { "date_histogram": { "field": "timestamp", "interval": "1d" }}},
// ],
// "size" : 10,
// "after" : ["a", 2, "c"]
// }
// }
// }
// }
//
// This method returns only the { "histogram" : { ... } } part.
source := make(map[string]interface{})
opts := make(map[string]interface{})
source["composite"] = opts
sources := make([]interface{}, len(a.sources))
for i, s := range a.sources {
src, err := s.Source()
if err != nil {
return nil, err
}
sources[i] = src
}
opts["sources"] = sources
if a.size != nil {
opts["size"] = *a.size
}
if a.after != nil {
opts["after"] = a.after
}
// AggregationBuilder (SubAggregations)
if len(a.subAggregations) > 0 {
aggsMap := make(map[string]interface{})
source["aggregations"] = aggsMap
for name, aggregate := range a.subAggregations {
src, err := aggregate.Source()
if err != nil {
return nil, err
}
aggsMap[name] = src
}
}
// Add Meta data if available
if len(a.meta) > 0 {
source["meta"] = a.meta
}
return source, nil
} | [
"func",
"(",
"a",
"*",
"CompositeAggregation",
")",
"Source",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// Example:",
"// {",
"// \"aggs\" : {",
"// \"my_composite_agg\" : {",
"// \"composite\" : {",
"// \"sources\": [",
"//\t\t\t\t {\"my_term\": { \"terms\": { \"field\": \"product\" }}},",
"//\t\t\t\t {\"my_histo\": { \"histogram\": { \"field\": \"price\", \"interval\": 5 }}},",
"//\t\t\t\t {\"my_date\": { \"date_histogram\": { \"field\": \"timestamp\", \"interval\": \"1d\" }}},",
"// ],",
"// \"size\" : 10,",
"// \"after\" : [\"a\", 2, \"c\"]",
"// }",
"// }",
"// }",
"// }",
"//",
"// This method returns only the { \"histogram\" : { ... } } part.",
"source",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"opts",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"source",
"[",
"\"",
"\"",
"]",
"=",
"opts",
"\n\n",
"sources",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"len",
"(",
"a",
".",
"sources",
")",
")",
"\n",
"for",
"i",
",",
"s",
":=",
"range",
"a",
".",
"sources",
"{",
"src",
",",
"err",
":=",
"s",
".",
"Source",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"sources",
"[",
"i",
"]",
"=",
"src",
"\n",
"}",
"\n",
"opts",
"[",
"\"",
"\"",
"]",
"=",
"sources",
"\n\n",
"if",
"a",
".",
"size",
"!=",
"nil",
"{",
"opts",
"[",
"\"",
"\"",
"]",
"=",
"*",
"a",
".",
"size",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"after",
"!=",
"nil",
"{",
"opts",
"[",
"\"",
"\"",
"]",
"=",
"a",
".",
"after",
"\n",
"}",
"\n\n",
"// AggregationBuilder (SubAggregations)",
"if",
"len",
"(",
"a",
".",
"subAggregations",
")",
">",
"0",
"{",
"aggsMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"source",
"[",
"\"",
"\"",
"]",
"=",
"aggsMap",
"\n",
"for",
"name",
",",
"aggregate",
":=",
"range",
"a",
".",
"subAggregations",
"{",
"src",
",",
"err",
":=",
"aggregate",
".",
"Source",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"aggsMap",
"[",
"name",
"]",
"=",
"src",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Add Meta data if available",
"if",
"len",
"(",
"a",
".",
"meta",
")",
">",
"0",
"{",
"source",
"[",
"\"",
"\"",
"]",
"=",
"a",
".",
"meta",
"\n",
"}",
"\n\n",
"return",
"source",
",",
"nil",
"\n",
"}"
] | // Source returns the serializable JSON for this aggregation. | [
"Source",
"returns",
"the",
"serializable",
"JSON",
"for",
"this",
"aggregation",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_composite.go#L62-L123 | train |
olivere/elastic | search_aggs_bucket_composite.go | NewCompositeAggregationHistogramValuesSource | func NewCompositeAggregationHistogramValuesSource(name string, interval float64) *CompositeAggregationHistogramValuesSource {
return &CompositeAggregationHistogramValuesSource{
name: name,
interval: interval,
}
} | go | func NewCompositeAggregationHistogramValuesSource(name string, interval float64) *CompositeAggregationHistogramValuesSource {
return &CompositeAggregationHistogramValuesSource{
name: name,
interval: interval,
}
} | [
"func",
"NewCompositeAggregationHistogramValuesSource",
"(",
"name",
"string",
",",
"interval",
"float64",
")",
"*",
"CompositeAggregationHistogramValuesSource",
"{",
"return",
"&",
"CompositeAggregationHistogramValuesSource",
"{",
"name",
":",
"name",
",",
"interval",
":",
"interval",
",",
"}",
"\n",
"}"
] | // NewCompositeAggregationHistogramValuesSource creates and initializes
// a new CompositeAggregationHistogramValuesSource. | [
"NewCompositeAggregationHistogramValuesSource",
"creates",
"and",
"initializes",
"a",
"new",
"CompositeAggregationHistogramValuesSource",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_composite.go#L282-L287 | train |
olivere/elastic | search_aggs_bucket_composite.go | Interval | func (a *CompositeAggregationHistogramValuesSource) Interval(interval float64) *CompositeAggregationHistogramValuesSource {
a.interval = interval
return a
} | go | func (a *CompositeAggregationHistogramValuesSource) Interval(interval float64) *CompositeAggregationHistogramValuesSource {
a.interval = interval
return a
} | [
"func",
"(",
"a",
"*",
"CompositeAggregationHistogramValuesSource",
")",
"Interval",
"(",
"interval",
"float64",
")",
"*",
"CompositeAggregationHistogramValuesSource",
"{",
"a",
".",
"interval",
"=",
"interval",
"\n",
"return",
"a",
"\n",
"}"
] | // Interval specifies the interval to use. | [
"Interval",
"specifies",
"the",
"interval",
"to",
"use",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_composite.go#L344-L347 | train |
olivere/elastic | search_aggs_bucket_composite.go | NewCompositeAggregationDateHistogramValuesSource | func NewCompositeAggregationDateHistogramValuesSource(name string, interval interface{}) *CompositeAggregationDateHistogramValuesSource {
return &CompositeAggregationDateHistogramValuesSource{
name: name,
interval: interval,
}
} | go | func NewCompositeAggregationDateHistogramValuesSource(name string, interval interface{}) *CompositeAggregationDateHistogramValuesSource {
return &CompositeAggregationDateHistogramValuesSource{
name: name,
interval: interval,
}
} | [
"func",
"NewCompositeAggregationDateHistogramValuesSource",
"(",
"name",
"string",
",",
"interval",
"interface",
"{",
"}",
")",
"*",
"CompositeAggregationDateHistogramValuesSource",
"{",
"return",
"&",
"CompositeAggregationDateHistogramValuesSource",
"{",
"name",
":",
"name",
",",
"interval",
":",
"interval",
",",
"}",
"\n",
"}"
] | // NewCompositeAggregationDateHistogramValuesSource creates and initializes
// a new CompositeAggregationDateHistogramValuesSource. | [
"NewCompositeAggregationDateHistogramValuesSource",
"creates",
"and",
"initializes",
"a",
"new",
"CompositeAggregationDateHistogramValuesSource",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_composite.go#L420-L425 | train |
olivere/elastic | search_aggs_bucket_composite.go | TimeZone | func (a *CompositeAggregationDateHistogramValuesSource) TimeZone(timeZone string) *CompositeAggregationDateHistogramValuesSource {
a.timeZone = timeZone
return a
} | go | func (a *CompositeAggregationDateHistogramValuesSource) TimeZone(timeZone string) *CompositeAggregationDateHistogramValuesSource {
a.timeZone = timeZone
return a
} | [
"func",
"(",
"a",
"*",
"CompositeAggregationDateHistogramValuesSource",
")",
"TimeZone",
"(",
"timeZone",
"string",
")",
"*",
"CompositeAggregationDateHistogramValuesSource",
"{",
"a",
".",
"timeZone",
"=",
"timeZone",
"\n",
"return",
"a",
"\n",
"}"
] | // TimeZone to use for the dates. | [
"TimeZone",
"to",
"use",
"for",
"the",
"dates",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_composite.go#L494-L497 | train |
olivere/elastic | search_aggs_bucket_composite.go | Source | func (a *CompositeAggregationDateHistogramValuesSource) Source() (interface{}, error) {
source := make(map[string]interface{})
name := make(map[string]interface{})
source[a.name] = name
values := make(map[string]interface{})
name["date_histogram"] = values
// field
if a.field != "" {
values["field"] = a.field
}
// script
if a.script != nil {
src, err := a.script.Source()
if err != nil {
return nil, err
}
values["script"] = src
}
// missing
if a.missing != nil {
values["missing"] = a.missing
}
// missing_bucket
if a.missingBucket != nil {
values["missing_bucket"] = *a.missingBucket
}
// value_type
if a.valueType != "" {
values["value_type"] = a.valueType
}
// order
if a.order != "" {
values["order"] = a.order
}
if a.format != "" {
values["format"] = a.format
}
// DateHistogram-related properties
values["interval"] = a.interval
// timeZone
if a.timeZone != "" {
values["time_zone"] = a.timeZone
}
return source, nil
} | go | func (a *CompositeAggregationDateHistogramValuesSource) Source() (interface{}, error) {
source := make(map[string]interface{})
name := make(map[string]interface{})
source[a.name] = name
values := make(map[string]interface{})
name["date_histogram"] = values
// field
if a.field != "" {
values["field"] = a.field
}
// script
if a.script != nil {
src, err := a.script.Source()
if err != nil {
return nil, err
}
values["script"] = src
}
// missing
if a.missing != nil {
values["missing"] = a.missing
}
// missing_bucket
if a.missingBucket != nil {
values["missing_bucket"] = *a.missingBucket
}
// value_type
if a.valueType != "" {
values["value_type"] = a.valueType
}
// order
if a.order != "" {
values["order"] = a.order
}
if a.format != "" {
values["format"] = a.format
}
// DateHistogram-related properties
values["interval"] = a.interval
// timeZone
if a.timeZone != "" {
values["time_zone"] = a.timeZone
}
return source, nil
} | [
"func",
"(",
"a",
"*",
"CompositeAggregationDateHistogramValuesSource",
")",
"Source",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"source",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"name",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"source",
"[",
"a",
".",
"name",
"]",
"=",
"name",
"\n",
"values",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"name",
"[",
"\"",
"\"",
"]",
"=",
"values",
"\n\n",
"// field",
"if",
"a",
".",
"field",
"!=",
"\"",
"\"",
"{",
"values",
"[",
"\"",
"\"",
"]",
"=",
"a",
".",
"field",
"\n",
"}",
"\n\n",
"// script",
"if",
"a",
".",
"script",
"!=",
"nil",
"{",
"src",
",",
"err",
":=",
"a",
".",
"script",
".",
"Source",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"values",
"[",
"\"",
"\"",
"]",
"=",
"src",
"\n",
"}",
"\n\n",
"// missing",
"if",
"a",
".",
"missing",
"!=",
"nil",
"{",
"values",
"[",
"\"",
"\"",
"]",
"=",
"a",
".",
"missing",
"\n",
"}",
"\n\n",
"// missing_bucket",
"if",
"a",
".",
"missingBucket",
"!=",
"nil",
"{",
"values",
"[",
"\"",
"\"",
"]",
"=",
"*",
"a",
".",
"missingBucket",
"\n",
"}",
"\n\n",
"// value_type",
"if",
"a",
".",
"valueType",
"!=",
"\"",
"\"",
"{",
"values",
"[",
"\"",
"\"",
"]",
"=",
"a",
".",
"valueType",
"\n",
"}",
"\n\n",
"// order",
"if",
"a",
".",
"order",
"!=",
"\"",
"\"",
"{",
"values",
"[",
"\"",
"\"",
"]",
"=",
"a",
".",
"order",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"format",
"!=",
"\"",
"\"",
"{",
"values",
"[",
"\"",
"\"",
"]",
"=",
"a",
".",
"format",
"\n",
"}",
"\n\n",
"// DateHistogram-related properties",
"values",
"[",
"\"",
"\"",
"]",
"=",
"a",
".",
"interval",
"\n\n",
"// timeZone",
"if",
"a",
".",
"timeZone",
"!=",
"\"",
"\"",
"{",
"values",
"[",
"\"",
"\"",
"]",
"=",
"a",
".",
"timeZone",
"\n",
"}",
"\n\n",
"return",
"source",
",",
"nil",
"\n",
"}"
] | // Source returns the serializable JSON for this values source. | [
"Source",
"returns",
"the",
"serializable",
"JSON",
"for",
"this",
"values",
"source",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_composite.go#L500-L554 | train |
olivere/elastic | indices_unfreeze.go | Index | func (s *IndicesUnfreezeService) Index(index string) *IndicesUnfreezeService {
s.index = index
return s
} | go | func (s *IndicesUnfreezeService) Index(index string) *IndicesUnfreezeService {
s.index = index
return s
} | [
"func",
"(",
"s",
"*",
"IndicesUnfreezeService",
")",
"Index",
"(",
"index",
"string",
")",
"*",
"IndicesUnfreezeService",
"{",
"s",
".",
"index",
"=",
"index",
"\n",
"return",
"s",
"\n",
"}"
] | // Index is the name of the index to unfreeze. | [
"Index",
"is",
"the",
"name",
"of",
"the",
"index",
"to",
"unfreeze",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_unfreeze.go#L40-L43 | train |
olivere/elastic | reindex.go | RequestsPerSecond | func (s *ReindexService) RequestsPerSecond(requestsPerSecond int) *ReindexService {
s.requestsPerSecond = &requestsPerSecond
return s
} | go | func (s *ReindexService) RequestsPerSecond(requestsPerSecond int) *ReindexService {
s.requestsPerSecond = &requestsPerSecond
return s
} | [
"func",
"(",
"s",
"*",
"ReindexService",
")",
"RequestsPerSecond",
"(",
"requestsPerSecond",
"int",
")",
"*",
"ReindexService",
"{",
"s",
".",
"requestsPerSecond",
"=",
"&",
"requestsPerSecond",
"\n",
"return",
"s",
"\n",
"}"
] | // RequestsPerSecond specifies the throttle to set on this request in sub-requests per second.
// -1 means set no throttle as does "unlimited" which is the only non-float this accepts. | [
"RequestsPerSecond",
"specifies",
"the",
"throttle",
"to",
"set",
"on",
"this",
"request",
"in",
"sub",
"-",
"requests",
"per",
"second",
".",
"-",
"1",
"means",
"set",
"no",
"throttle",
"as",
"does",
"unlimited",
"which",
"is",
"the",
"only",
"non",
"-",
"float",
"this",
"accepts",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L53-L56 | train |
olivere/elastic | reindex.go | WaitForCompletion | func (s *ReindexService) WaitForCompletion(waitForCompletion bool) *ReindexService {
s.waitForCompletion = &waitForCompletion
return s
} | go | func (s *ReindexService) WaitForCompletion(waitForCompletion bool) *ReindexService {
s.waitForCompletion = &waitForCompletion
return s
} | [
"func",
"(",
"s",
"*",
"ReindexService",
")",
"WaitForCompletion",
"(",
"waitForCompletion",
"bool",
")",
"*",
"ReindexService",
"{",
"s",
".",
"waitForCompletion",
"=",
"&",
"waitForCompletion",
"\n",
"return",
"s",
"\n",
"}"
] | // WaitForCompletion indicates whether Elasticsearch should block until the
// reindex is complete. | [
"WaitForCompletion",
"indicates",
"whether",
"Elasticsearch",
"should",
"block",
"until",
"the",
"reindex",
"is",
"complete",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L87-L90 | train |
olivere/elastic | reindex.go | Header | func (s *ReindexService) Header(name string, value string) *ReindexService {
if s.headers == nil {
s.headers = http.Header{}
}
s.headers.Add(name, value)
return s
} | go | func (s *ReindexService) Header(name string, value string) *ReindexService {
if s.headers == nil {
s.headers = http.Header{}
}
s.headers.Add(name, value)
return s
} | [
"func",
"(",
"s",
"*",
"ReindexService",
")",
"Header",
"(",
"name",
"string",
",",
"value",
"string",
")",
"*",
"ReindexService",
"{",
"if",
"s",
".",
"headers",
"==",
"nil",
"{",
"s",
".",
"headers",
"=",
"http",
".",
"Header",
"{",
"}",
"\n",
"}",
"\n",
"s",
".",
"headers",
".",
"Add",
"(",
"name",
",",
"value",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // Header sets headers on the request | [
"Header",
"sets",
"headers",
"on",
"the",
"request"
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L93-L99 | train |
olivere/elastic | reindex.go | Source | func (s *ReindexService) Source(source *ReindexSource) *ReindexService {
s.source = source
return s
} | go | func (s *ReindexService) Source(source *ReindexSource) *ReindexService {
s.source = source
return s
} | [
"func",
"(",
"s",
"*",
"ReindexService",
")",
"Source",
"(",
"source",
"*",
"ReindexSource",
")",
"*",
"ReindexService",
"{",
"s",
".",
"source",
"=",
"source",
"\n",
"return",
"s",
"\n",
"}"
] | // Source specifies the source of the reindexing process. | [
"Source",
"specifies",
"the",
"source",
"of",
"the",
"reindexing",
"process",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L108-L111 | train |
olivere/elastic | reindex.go | SourceIndex | func (s *ReindexService) SourceIndex(index string) *ReindexService {
if s.source == nil {
s.source = NewReindexSource()
}
s.source = s.source.Index(index)
return s
} | go | func (s *ReindexService) SourceIndex(index string) *ReindexService {
if s.source == nil {
s.source = NewReindexSource()
}
s.source = s.source.Index(index)
return s
} | [
"func",
"(",
"s",
"*",
"ReindexService",
")",
"SourceIndex",
"(",
"index",
"string",
")",
"*",
"ReindexService",
"{",
"if",
"s",
".",
"source",
"==",
"nil",
"{",
"s",
".",
"source",
"=",
"NewReindexSource",
"(",
")",
"\n",
"}",
"\n",
"s",
".",
"source",
"=",
"s",
".",
"source",
".",
"Index",
"(",
"index",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // SourceIndex specifies the source index of the reindexing process. | [
"SourceIndex",
"specifies",
"the",
"source",
"index",
"of",
"the",
"reindexing",
"process",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L114-L120 | train |
olivere/elastic | reindex.go | Destination | func (s *ReindexService) Destination(destination *ReindexDestination) *ReindexService {
s.destination = destination
return s
} | go | func (s *ReindexService) Destination(destination *ReindexDestination) *ReindexService {
s.destination = destination
return s
} | [
"func",
"(",
"s",
"*",
"ReindexService",
")",
"Destination",
"(",
"destination",
"*",
"ReindexDestination",
")",
"*",
"ReindexService",
"{",
"s",
".",
"destination",
"=",
"destination",
"\n",
"return",
"s",
"\n",
"}"
] | // Destination specifies the destination of the reindexing process. | [
"Destination",
"specifies",
"the",
"destination",
"of",
"the",
"reindexing",
"process",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L123-L126 | train |
olivere/elastic | reindex.go | DestinationIndex | func (s *ReindexService) DestinationIndex(index string) *ReindexService {
if s.destination == nil {
s.destination = NewReindexDestination()
}
s.destination = s.destination.Index(index)
return s
} | go | func (s *ReindexService) DestinationIndex(index string) *ReindexService {
if s.destination == nil {
s.destination = NewReindexDestination()
}
s.destination = s.destination.Index(index)
return s
} | [
"func",
"(",
"s",
"*",
"ReindexService",
")",
"DestinationIndex",
"(",
"index",
"string",
")",
"*",
"ReindexService",
"{",
"if",
"s",
".",
"destination",
"==",
"nil",
"{",
"s",
".",
"destination",
"=",
"NewReindexDestination",
"(",
")",
"\n",
"}",
"\n",
"s",
".",
"destination",
"=",
"s",
".",
"destination",
".",
"Index",
"(",
"index",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // DestinationIndex specifies the destination index of the reindexing process. | [
"DestinationIndex",
"specifies",
"the",
"destination",
"index",
"of",
"the",
"reindexing",
"process",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L129-L135 | train |
olivere/elastic | reindex.go | DestinationIndexAndType | func (s *ReindexService) DestinationIndexAndType(index, typ string) *ReindexService {
if s.destination == nil {
s.destination = NewReindexDestination()
}
s.destination = s.destination.Index(index)
s.destination = s.destination.Type(typ)
return s
} | go | func (s *ReindexService) DestinationIndexAndType(index, typ string) *ReindexService {
if s.destination == nil {
s.destination = NewReindexDestination()
}
s.destination = s.destination.Index(index)
s.destination = s.destination.Type(typ)
return s
} | [
"func",
"(",
"s",
"*",
"ReindexService",
")",
"DestinationIndexAndType",
"(",
"index",
",",
"typ",
"string",
")",
"*",
"ReindexService",
"{",
"if",
"s",
".",
"destination",
"==",
"nil",
"{",
"s",
".",
"destination",
"=",
"NewReindexDestination",
"(",
")",
"\n",
"}",
"\n",
"s",
".",
"destination",
"=",
"s",
".",
"destination",
".",
"Index",
"(",
"index",
")",
"\n",
"s",
".",
"destination",
"=",
"s",
".",
"destination",
".",
"Type",
"(",
"typ",
")",
"\n",
"return",
"s",
"\n",
"}"
] | // DestinationIndexAndType specifies both the destination index and type
// of the reindexing process. | [
"DestinationIndexAndType",
"specifies",
"both",
"the",
"destination",
"index",
"and",
"type",
"of",
"the",
"reindexing",
"process",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L139-L146 | train |
olivere/elastic | reindex.go | Size | func (s *ReindexService) Size(size int) *ReindexService {
s.size = &size
return s
} | go | func (s *ReindexService) Size(size int) *ReindexService {
s.size = &size
return s
} | [
"func",
"(",
"s",
"*",
"ReindexService",
")",
"Size",
"(",
"size",
"int",
")",
"*",
"ReindexService",
"{",
"s",
".",
"size",
"=",
"&",
"size",
"\n",
"return",
"s",
"\n",
"}"
] | // Size sets an upper limit for the number of processed documents. | [
"Size",
"sets",
"an",
"upper",
"limit",
"for",
"the",
"number",
"of",
"processed",
"documents",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L170-L173 | train |
olivere/elastic | reindex.go | Script | func (s *ReindexService) Script(script *Script) *ReindexService {
s.script = script
return s
} | go | func (s *ReindexService) Script(script *Script) *ReindexService {
s.script = script
return s
} | [
"func",
"(",
"s",
"*",
"ReindexService",
")",
"Script",
"(",
"script",
"*",
"Script",
")",
"*",
"ReindexService",
"{",
"s",
".",
"script",
"=",
"script",
"\n",
"return",
"s",
"\n",
"}"
] | // Script allows for modification of the documents as they are reindexed
// from source to destination. | [
"Script",
"allows",
"for",
"modification",
"of",
"the",
"documents",
"as",
"they",
"are",
"reindexed",
"from",
"source",
"to",
"destination",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L177-L180 | train |
olivere/elastic | reindex.go | Request | func (r *ReindexSource) Request(request *SearchRequest) *ReindexSource {
if request == nil {
r.request = NewSearchRequest()
} else {
r.request = request
}
return r
} | go | func (r *ReindexSource) Request(request *SearchRequest) *ReindexSource {
if request == nil {
r.request = NewSearchRequest()
} else {
r.request = request
}
return r
} | [
"func",
"(",
"r",
"*",
"ReindexSource",
")",
"Request",
"(",
"request",
"*",
"SearchRequest",
")",
"*",
"ReindexSource",
"{",
"if",
"request",
"==",
"nil",
"{",
"r",
".",
"request",
"=",
"NewSearchRequest",
"(",
")",
"\n",
"}",
"else",
"{",
"r",
".",
"request",
"=",
"request",
"\n",
"}",
"\n",
"return",
"r",
"\n",
"}"
] | // Request specifies the search request used for source. | [
"Request",
"specifies",
"the",
"search",
"request",
"used",
"for",
"source",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L397-L404 | train |
olivere/elastic | reindex.go | RemoteInfo | func (r *ReindexSource) RemoteInfo(ri *ReindexRemoteInfo) *ReindexSource {
r.remoteInfo = ri
return r
} | go | func (r *ReindexSource) RemoteInfo(ri *ReindexRemoteInfo) *ReindexSource {
r.remoteInfo = ri
return r
} | [
"func",
"(",
"r",
"*",
"ReindexSource",
")",
"RemoteInfo",
"(",
"ri",
"*",
"ReindexRemoteInfo",
")",
"*",
"ReindexSource",
"{",
"r",
".",
"remoteInfo",
"=",
"ri",
"\n",
"return",
"r",
"\n",
"}"
] | // RemoteInfo sets up reindexing from a remote cluster. | [
"RemoteInfo",
"sets",
"up",
"reindexing",
"from",
"a",
"remote",
"cluster",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L494-L497 | train |
olivere/elastic | reindex.go | Username | func (ri *ReindexRemoteInfo) Username(username string) *ReindexRemoteInfo {
ri.username = username
return ri
} | go | func (ri *ReindexRemoteInfo) Username(username string) *ReindexRemoteInfo {
ri.username = username
return ri
} | [
"func",
"(",
"ri",
"*",
"ReindexRemoteInfo",
")",
"Username",
"(",
"username",
"string",
")",
"*",
"ReindexRemoteInfo",
"{",
"ri",
".",
"username",
"=",
"username",
"\n",
"return",
"ri",
"\n",
"}"
] | // Username sets the username to authenticate with the remote cluster. | [
"Username",
"sets",
"the",
"username",
"to",
"authenticate",
"with",
"the",
"remote",
"cluster",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L555-L558 | train |
olivere/elastic | reindex.go | Password | func (ri *ReindexRemoteInfo) Password(password string) *ReindexRemoteInfo {
ri.password = password
return ri
} | go | func (ri *ReindexRemoteInfo) Password(password string) *ReindexRemoteInfo {
ri.password = password
return ri
} | [
"func",
"(",
"ri",
"*",
"ReindexRemoteInfo",
")",
"Password",
"(",
"password",
"string",
")",
"*",
"ReindexRemoteInfo",
"{",
"ri",
".",
"password",
"=",
"password",
"\n",
"return",
"ri",
"\n",
"}"
] | // Password sets the password to authenticate with the remote cluster. | [
"Password",
"sets",
"the",
"password",
"to",
"authenticate",
"with",
"the",
"remote",
"cluster",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L561-L564 | train |
olivere/elastic | reindex.go | Source | func (ri *ReindexRemoteInfo) Source() (interface{}, error) {
res := make(map[string]interface{})
res["host"] = ri.host
if len(ri.username) > 0 {
res["username"] = ri.username
}
if len(ri.password) > 0 {
res["password"] = ri.password
}
if len(ri.socketTimeout) > 0 {
res["socket_timeout"] = ri.socketTimeout
}
if len(ri.connectTimeout) > 0 {
res["connect_timeout"] = ri.connectTimeout
}
return res, nil
} | go | func (ri *ReindexRemoteInfo) Source() (interface{}, error) {
res := make(map[string]interface{})
res["host"] = ri.host
if len(ri.username) > 0 {
res["username"] = ri.username
}
if len(ri.password) > 0 {
res["password"] = ri.password
}
if len(ri.socketTimeout) > 0 {
res["socket_timeout"] = ri.socketTimeout
}
if len(ri.connectTimeout) > 0 {
res["connect_timeout"] = ri.connectTimeout
}
return res, nil
} | [
"func",
"(",
"ri",
"*",
"ReindexRemoteInfo",
")",
"Source",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"res",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"res",
"[",
"\"",
"\"",
"]",
"=",
"ri",
".",
"host",
"\n",
"if",
"len",
"(",
"ri",
".",
"username",
")",
">",
"0",
"{",
"res",
"[",
"\"",
"\"",
"]",
"=",
"ri",
".",
"username",
"\n",
"}",
"\n",
"if",
"len",
"(",
"ri",
".",
"password",
")",
">",
"0",
"{",
"res",
"[",
"\"",
"\"",
"]",
"=",
"ri",
".",
"password",
"\n",
"}",
"\n",
"if",
"len",
"(",
"ri",
".",
"socketTimeout",
")",
">",
"0",
"{",
"res",
"[",
"\"",
"\"",
"]",
"=",
"ri",
".",
"socketTimeout",
"\n",
"}",
"\n",
"if",
"len",
"(",
"ri",
".",
"connectTimeout",
")",
">",
"0",
"{",
"res",
"[",
"\"",
"\"",
"]",
"=",
"ri",
".",
"connectTimeout",
"\n",
"}",
"\n",
"return",
"res",
",",
"nil",
"\n",
"}"
] | // Source returns the serializable JSON data for the request. | [
"Source",
"returns",
"the",
"serializable",
"JSON",
"data",
"for",
"the",
"request",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L581-L597 | train |
olivere/elastic | reindex.go | Index | func (r *ReindexDestination) Index(index string) *ReindexDestination {
r.index = index
return r
} | go | func (r *ReindexDestination) Index(index string) *ReindexDestination {
r.index = index
return r
} | [
"func",
"(",
"r",
"*",
"ReindexDestination",
")",
"Index",
"(",
"index",
"string",
")",
"*",
"ReindexDestination",
"{",
"r",
".",
"index",
"=",
"index",
"\n",
"return",
"r",
"\n",
"}"
] | // Index specifies name of the Elasticsearch index to use as the destination
// of a reindexing process. | [
"Index",
"specifies",
"name",
"of",
"the",
"Elasticsearch",
"index",
"to",
"use",
"as",
"the",
"destination",
"of",
"a",
"reindexing",
"process",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L623-L626 | train |
olivere/elastic | reindex.go | Type | func (r *ReindexDestination) Type(typ string) *ReindexDestination {
r.typ = typ
return r
} | go | func (r *ReindexDestination) Type(typ string) *ReindexDestination {
r.typ = typ
return r
} | [
"func",
"(",
"r",
"*",
"ReindexDestination",
")",
"Type",
"(",
"typ",
"string",
")",
"*",
"ReindexDestination",
"{",
"r",
".",
"typ",
"=",
"typ",
"\n",
"return",
"r",
"\n",
"}"
] | // Type specifies the Elasticsearch type to use for reindexing. | [
"Type",
"specifies",
"the",
"Elasticsearch",
"type",
"to",
"use",
"for",
"reindexing",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L629-L632 | train |
olivere/elastic | reindex.go | Routing | func (r *ReindexDestination) Routing(routing string) *ReindexDestination {
r.routing = routing
return r
} | go | func (r *ReindexDestination) Routing(routing string) *ReindexDestination {
r.routing = routing
return r
} | [
"func",
"(",
"r",
"*",
"ReindexDestination",
")",
"Routing",
"(",
"routing",
"string",
")",
"*",
"ReindexDestination",
"{",
"r",
".",
"routing",
"=",
"routing",
"\n",
"return",
"r",
"\n",
"}"
] | // Routing specifies a routing value for the reindexing request.
// It can be "keep", "discard", or start with "=". The latter specifies
// the routing on the bulk request. | [
"Routing",
"specifies",
"a",
"routing",
"value",
"for",
"the",
"reindexing",
"request",
".",
"It",
"can",
"be",
"keep",
"discard",
"or",
"start",
"with",
"=",
".",
"The",
"latter",
"specifies",
"the",
"routing",
"on",
"the",
"bulk",
"request",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L637-L640 | train |
olivere/elastic | reindex.go | VersionType | func (r *ReindexDestination) VersionType(versionType string) *ReindexDestination {
r.versionType = versionType
return r
} | go | func (r *ReindexDestination) VersionType(versionType string) *ReindexDestination {
r.versionType = versionType
return r
} | [
"func",
"(",
"r",
"*",
"ReindexDestination",
")",
"VersionType",
"(",
"versionType",
"string",
")",
"*",
"ReindexDestination",
"{",
"r",
".",
"versionType",
"=",
"versionType",
"\n",
"return",
"r",
"\n",
"}"
] | // VersionType specifies how versions are created. | [
"VersionType",
"specifies",
"how",
"versions",
"are",
"created",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/reindex.go#L678-L681 | train |
olivere/elastic | suggester_context_category.go | NewSuggesterCategoryMapping | func NewSuggesterCategoryMapping(name string) *SuggesterCategoryMapping {
return &SuggesterCategoryMapping{
name: name,
defaultValues: make([]string, 0),
}
} | go | func NewSuggesterCategoryMapping(name string) *SuggesterCategoryMapping {
return &SuggesterCategoryMapping{
name: name,
defaultValues: make([]string, 0),
}
} | [
"func",
"NewSuggesterCategoryMapping",
"(",
"name",
"string",
")",
"*",
"SuggesterCategoryMapping",
"{",
"return",
"&",
"SuggesterCategoryMapping",
"{",
"name",
":",
"name",
",",
"defaultValues",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"}",
"\n",
"}"
] | // NewSuggesterCategoryMapping creates a new SuggesterCategoryMapping. | [
"NewSuggesterCategoryMapping",
"creates",
"a",
"new",
"SuggesterCategoryMapping",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/suggester_context_category.go#L18-L23 | train |
olivere/elastic | suggester_context_category.go | NewSuggesterCategoryIndex | func NewSuggesterCategoryIndex(name string, values ...string) *SuggesterCategoryIndex {
q := &SuggesterCategoryIndex{
name: name,
values: values,
}
return q
} | go | func NewSuggesterCategoryIndex(name string, values ...string) *SuggesterCategoryIndex {
q := &SuggesterCategoryIndex{
name: name,
values: values,
}
return q
} | [
"func",
"NewSuggesterCategoryIndex",
"(",
"name",
"string",
",",
"values",
"...",
"string",
")",
"*",
"SuggesterCategoryIndex",
"{",
"q",
":=",
"&",
"SuggesterCategoryIndex",
"{",
"name",
":",
"name",
",",
"values",
":",
"values",
",",
"}",
"\n",
"return",
"q",
"\n",
"}"
] | // NewSuggesterCategoryIndex creates a new SuggesterCategoryIndex. | [
"NewSuggesterCategoryIndex",
"creates",
"a",
"new",
"SuggesterCategoryIndex",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/suggester_context_category.go#L127-L133 | train |
olivere/elastic | ingest_simulate_pipeline.go | Id | func (s *IngestSimulatePipelineService) Id(id string) *IngestSimulatePipelineService {
s.id = id
return s
} | go | func (s *IngestSimulatePipelineService) Id(id string) *IngestSimulatePipelineService {
s.id = id
return s
} | [
"func",
"(",
"s",
"*",
"IngestSimulatePipelineService",
")",
"Id",
"(",
"id",
"string",
")",
"*",
"IngestSimulatePipelineService",
"{",
"s",
".",
"id",
"=",
"id",
"\n",
"return",
"s",
"\n",
"}"
] | // Id specifies the pipeline ID. | [
"Id",
"specifies",
"the",
"pipeline",
"ID",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/ingest_simulate_pipeline.go#L38-L41 | train |
olivere/elastic | ingest_simulate_pipeline.go | Verbose | func (s *IngestSimulatePipelineService) Verbose(verbose bool) *IngestSimulatePipelineService {
s.verbose = &verbose
return s
} | go | func (s *IngestSimulatePipelineService) Verbose(verbose bool) *IngestSimulatePipelineService {
s.verbose = &verbose
return s
} | [
"func",
"(",
"s",
"*",
"IngestSimulatePipelineService",
")",
"Verbose",
"(",
"verbose",
"bool",
")",
"*",
"IngestSimulatePipelineService",
"{",
"s",
".",
"verbose",
"=",
"&",
"verbose",
"\n",
"return",
"s",
"\n",
"}"
] | // Verbose mode. Display data output for each processor in executed pipeline. | [
"Verbose",
"mode",
".",
"Display",
"data",
"output",
"for",
"each",
"processor",
"in",
"executed",
"pipeline",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/ingest_simulate_pipeline.go#L44-L47 | train |
olivere/elastic | ingest_simulate_pipeline.go | BodyString | func (s *IngestSimulatePipelineService) BodyString(body string) *IngestSimulatePipelineService {
s.bodyString = body
return s
} | go | func (s *IngestSimulatePipelineService) BodyString(body string) *IngestSimulatePipelineService {
s.bodyString = body
return s
} | [
"func",
"(",
"s",
"*",
"IngestSimulatePipelineService",
")",
"BodyString",
"(",
"body",
"string",
")",
"*",
"IngestSimulatePipelineService",
"{",
"s",
".",
"bodyString",
"=",
"body",
"\n",
"return",
"s",
"\n",
"}"
] | // BodyString is the simulate definition, defined as a string. | [
"BodyString",
"is",
"the",
"simulate",
"definition",
"defined",
"as",
"a",
"string",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/ingest_simulate_pipeline.go#L63-L66 | train |
olivere/elastic | indices_put_mapping.go | NewIndicesPutMappingService | func NewIndicesPutMappingService(client *Client) *IndicesPutMappingService {
return &IndicesPutMappingService{
client: client,
index: make([]string, 0),
}
} | go | func NewIndicesPutMappingService(client *Client) *IndicesPutMappingService {
return &IndicesPutMappingService{
client: client,
index: make([]string, 0),
}
} | [
"func",
"NewIndicesPutMappingService",
"(",
"client",
"*",
"Client",
")",
"*",
"IndicesPutMappingService",
"{",
"return",
"&",
"IndicesPutMappingService",
"{",
"client",
":",
"client",
",",
"index",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"}",
"\n",
"}"
] | // NewIndicesPutMappingService creates a new IndicesPutMappingService. | [
"NewIndicesPutMappingService",
"creates",
"a",
"new",
"IndicesPutMappingService",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_put_mapping.go#L42-L47 | train |
olivere/elastic | trace/opencensus/transport.go | WithDefaultAttributes | func WithDefaultAttributes(attrs ...trace.Attribute) Option {
return func(t *Transport) {
t.defaultAttributes = attrs
}
} | go | func WithDefaultAttributes(attrs ...trace.Attribute) Option {
return func(t *Transport) {
t.defaultAttributes = attrs
}
} | [
"func",
"WithDefaultAttributes",
"(",
"attrs",
"...",
"trace",
".",
"Attribute",
")",
"Option",
"{",
"return",
"func",
"(",
"t",
"*",
"Transport",
")",
"{",
"t",
".",
"defaultAttributes",
"=",
"attrs",
"\n",
"}",
"\n",
"}"
] | // WithDefaultAttributes specifies default attributes to add
// to each span. | [
"WithDefaultAttributes",
"specifies",
"default",
"attributes",
"to",
"add",
"to",
"each",
"span",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/trace/opencensus/transport.go#L37-L41 | train |
olivere/elastic | trace/opencensus/transport.go | NewTransport | func NewTransport(opts ...Option) *Transport {
t := &Transport{}
for _, o := range opts {
o(t)
}
return t
} | go | func NewTransport(opts ...Option) *Transport {
t := &Transport{}
for _, o := range opts {
o(t)
}
return t
} | [
"func",
"NewTransport",
"(",
"opts",
"...",
"Option",
")",
"*",
"Transport",
"{",
"t",
":=",
"&",
"Transport",
"{",
"}",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"o",
"(",
"t",
")",
"\n",
"}",
"\n",
"return",
"t",
"\n",
"}"
] | // NewTransport specifies a transport that will trace Elastic
// and report back via OpenTracing. | [
"NewTransport",
"specifies",
"a",
"transport",
"that",
"will",
"trace",
"Elastic",
"and",
"report",
"back",
"via",
"OpenTracing",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/trace/opencensus/transport.go#L45-L51 | train |
olivere/elastic | trace/opencensus/transport.go | isContextErr | func isContextErr(err error) bool {
if err == context.Canceled || err == context.DeadlineExceeded {
return true
}
// This happens e.g. on redirect errors, see https://golang.org/src/net/http/client_test.go#L329
if ue, ok := err.(*url.Error); ok {
if ue.Temporary() {
return true
}
// Use of an AWS Signing Transport can result in a wrapped url.Error
return isContextErr(ue.Err)
}
return false
} | go | func isContextErr(err error) bool {
if err == context.Canceled || err == context.DeadlineExceeded {
return true
}
// This happens e.g. on redirect errors, see https://golang.org/src/net/http/client_test.go#L329
if ue, ok := err.(*url.Error); ok {
if ue.Temporary() {
return true
}
// Use of an AWS Signing Transport can result in a wrapped url.Error
return isContextErr(ue.Err)
}
return false
} | [
"func",
"isContextErr",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"context",
".",
"Canceled",
"||",
"err",
"==",
"context",
".",
"DeadlineExceeded",
"{",
"return",
"true",
"\n",
"}",
"\n",
"// This happens e.g. on redirect errors, see https://golang.org/src/net/http/client_test.go#L329",
"if",
"ue",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"url",
".",
"Error",
")",
";",
"ok",
"{",
"if",
"ue",
".",
"Temporary",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"// Use of an AWS Signing Transport can result in a wrapped url.Error",
"return",
"isContextErr",
"(",
"ue",
".",
"Err",
")",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // isContextErr returns true if the error is from a context that was canceled or deadline exceeded | [
"isContextErr",
"returns",
"true",
"if",
"the",
"error",
"is",
"from",
"a",
"context",
"that",
"was",
"canceled",
"or",
"deadline",
"exceeded"
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/trace/opencensus/transport.go#L142-L155 | train |
olivere/elastic | trace/opencensus/transport.go | isConnErr | func isConnErr(err error) bool {
if err == nil {
return false
}
if err.Error() == "no Elasticsearch node available" {
return true
}
innerErr := errors.Cause(err)
if innerErr == nil {
return false
}
if innerErr.Error() == "no Elasticsearch node available" {
return true
}
return false
} | go | func isConnErr(err error) bool {
if err == nil {
return false
}
if err.Error() == "no Elasticsearch node available" {
return true
}
innerErr := errors.Cause(err)
if innerErr == nil {
return false
}
if innerErr.Error() == "no Elasticsearch node available" {
return true
}
return false
} | [
"func",
"isConnErr",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"err",
".",
"Error",
"(",
")",
"==",
"\"",
"\"",
"{",
"return",
"true",
"\n",
"}",
"\n",
"innerErr",
":=",
"errors",
".",
"Cause",
"(",
"err",
")",
"\n",
"if",
"innerErr",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"innerErr",
".",
"Error",
"(",
")",
"==",
"\"",
"\"",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\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/trace/opencensus/transport.go#L159-L174 | train |
olivere/elastic | search_aggs_bucket_terms.go | CollectionMode | func (a *TermsAggregation) CollectionMode(collectionMode string) *TermsAggregation {
a.collectionMode = collectionMode
return a
} | go | func (a *TermsAggregation) CollectionMode(collectionMode string) *TermsAggregation {
a.collectionMode = collectionMode
return a
} | [
"func",
"(",
"a",
"*",
"TermsAggregation",
")",
"CollectionMode",
"(",
"collectionMode",
"string",
")",
"*",
"TermsAggregation",
"{",
"a",
".",
"collectionMode",
"=",
"collectionMode",
"\n",
"return",
"a",
"\n",
"}"
] | // Collection mode can be depth_first or breadth_first as of 1.4.0. | [
"Collection",
"mode",
"can",
"be",
"depth_first",
"or",
"breadth_first",
"as",
"of",
"1",
".",
"4",
".",
"0",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_terms.go#L239-L242 | train |
olivere/elastic | search_aggs_bucket_terms.go | Source | func (order *TermsOrder) Source() (interface{}, error) {
source := make(map[string]string)
if order.Ascending {
source[order.Field] = "asc"
} else {
source[order.Field] = "desc"
}
return source, nil
} | go | func (order *TermsOrder) Source() (interface{}, error) {
source := make(map[string]string)
if order.Ascending {
source[order.Field] = "asc"
} else {
source[order.Field] = "desc"
}
return source, nil
} | [
"func",
"(",
"order",
"*",
"TermsOrder",
")",
"Source",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"source",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"if",
"order",
".",
"Ascending",
"{",
"source",
"[",
"order",
".",
"Field",
"]",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"source",
"[",
"order",
".",
"Field",
"]",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"source",
",",
"nil",
"\n",
"}"
] | // Source returns serializable JSON of the TermsOrder. | [
"Source",
"returns",
"serializable",
"JSON",
"of",
"the",
"TermsOrder",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_bucket_terms.go#L378-L386 | train |
olivere/elastic | search_queries_boosting.go | Source | func (q *BoostingQuery) Source() (interface{}, error) {
// {
// "boosting" : {
// "positive" : {
// "term" : {
// "field1" : "value1"
// }
// },
// "negative" : {
// "term" : {
// "field2" : "value2"
// }
// },
// "negative_boost" : 0.2
// }
// }
query := make(map[string]interface{})
boostingClause := make(map[string]interface{})
query["boosting"] = boostingClause
// Negative and positive clause as well as negative boost
// are mandatory in the Java client.
// positive
if q.positiveClause != nil {
src, err := q.positiveClause.Source()
if err != nil {
return nil, err
}
boostingClause["positive"] = src
}
// negative
if q.negativeClause != nil {
src, err := q.negativeClause.Source()
if err != nil {
return nil, err
}
boostingClause["negative"] = src
}
if q.negativeBoost != nil {
boostingClause["negative_boost"] = *q.negativeBoost
}
if q.boost != nil {
boostingClause["boost"] = *q.boost
}
return query, nil
} | go | func (q *BoostingQuery) Source() (interface{}, error) {
// {
// "boosting" : {
// "positive" : {
// "term" : {
// "field1" : "value1"
// }
// },
// "negative" : {
// "term" : {
// "field2" : "value2"
// }
// },
// "negative_boost" : 0.2
// }
// }
query := make(map[string]interface{})
boostingClause := make(map[string]interface{})
query["boosting"] = boostingClause
// Negative and positive clause as well as negative boost
// are mandatory in the Java client.
// positive
if q.positiveClause != nil {
src, err := q.positiveClause.Source()
if err != nil {
return nil, err
}
boostingClause["positive"] = src
}
// negative
if q.negativeClause != nil {
src, err := q.negativeClause.Source()
if err != nil {
return nil, err
}
boostingClause["negative"] = src
}
if q.negativeBoost != nil {
boostingClause["negative_boost"] = *q.negativeBoost
}
if q.boost != nil {
boostingClause["boost"] = *q.boost
}
return query, nil
} | [
"func",
"(",
"q",
"*",
"BoostingQuery",
")",
"Source",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// {",
"// \"boosting\" : {",
"// \"positive\" : {",
"// \"term\" : {",
"// \"field1\" : \"value1\"",
"// }",
"// },",
"// \"negative\" : {",
"// \"term\" : {",
"// \"field2\" : \"value2\"",
"// }",
"// },",
"// \"negative_boost\" : 0.2",
"// }",
"// }",
"query",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n\n",
"boostingClause",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"query",
"[",
"\"",
"\"",
"]",
"=",
"boostingClause",
"\n\n",
"// Negative and positive clause as well as negative boost",
"// are mandatory in the Java client.",
"// positive",
"if",
"q",
".",
"positiveClause",
"!=",
"nil",
"{",
"src",
",",
"err",
":=",
"q",
".",
"positiveClause",
".",
"Source",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"boostingClause",
"[",
"\"",
"\"",
"]",
"=",
"src",
"\n",
"}",
"\n\n",
"// negative",
"if",
"q",
".",
"negativeClause",
"!=",
"nil",
"{",
"src",
",",
"err",
":=",
"q",
".",
"negativeClause",
".",
"Source",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"boostingClause",
"[",
"\"",
"\"",
"]",
"=",
"src",
"\n",
"}",
"\n\n",
"if",
"q",
".",
"negativeBoost",
"!=",
"nil",
"{",
"boostingClause",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"negativeBoost",
"\n",
"}",
"\n\n",
"if",
"q",
".",
"boost",
"!=",
"nil",
"{",
"boostingClause",
"[",
"\"",
"\"",
"]",
"=",
"*",
"q",
".",
"boost",
"\n",
"}",
"\n\n",
"return",
"query",
",",
"nil",
"\n",
"}"
] | // Creates the query source for the boosting query. | [
"Creates",
"the",
"query",
"source",
"for",
"the",
"boosting",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_boosting.go#L45-L97 | train |
olivere/elastic | search_queries_nested.go | NewNestedQuery | func NewNestedQuery(path string, query Query) *NestedQuery {
return &NestedQuery{path: path, query: query}
} | go | func NewNestedQuery(path string, query Query) *NestedQuery {
return &NestedQuery{path: path, query: query}
} | [
"func",
"NewNestedQuery",
"(",
"path",
"string",
",",
"query",
"Query",
")",
"*",
"NestedQuery",
"{",
"return",
"&",
"NestedQuery",
"{",
"path",
":",
"path",
",",
"query",
":",
"query",
"}",
"\n",
"}"
] | // NewNestedQuery creates and initializes a new NestedQuery. | [
"NewNestedQuery",
"creates",
"and",
"initializes",
"a",
"new",
"NestedQuery",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_nested.go#L25-L27 | train |
olivere/elastic | search_queries_nested.go | ScoreMode | func (q *NestedQuery) ScoreMode(scoreMode string) *NestedQuery {
q.scoreMode = scoreMode
return q
} | go | func (q *NestedQuery) ScoreMode(scoreMode string) *NestedQuery {
q.scoreMode = scoreMode
return q
} | [
"func",
"(",
"q",
"*",
"NestedQuery",
")",
"ScoreMode",
"(",
"scoreMode",
"string",
")",
"*",
"NestedQuery",
"{",
"q",
".",
"scoreMode",
"=",
"scoreMode",
"\n",
"return",
"q",
"\n",
"}"
] | // ScoreMode specifies the score mode. | [
"ScoreMode",
"specifies",
"the",
"score",
"mode",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_nested.go#L30-L33 | train |
olivere/elastic | search_queries_nested.go | InnerHit | func (q *NestedQuery) InnerHit(innerHit *InnerHit) *NestedQuery {
q.innerHit = innerHit
return q
} | go | func (q *NestedQuery) InnerHit(innerHit *InnerHit) *NestedQuery {
q.innerHit = innerHit
return q
} | [
"func",
"(",
"q",
"*",
"NestedQuery",
")",
"InnerHit",
"(",
"innerHit",
"*",
"InnerHit",
")",
"*",
"NestedQuery",
"{",
"q",
".",
"innerHit",
"=",
"innerHit",
"\n",
"return",
"q",
"\n",
"}"
] | // InnerHit sets the inner hit definition in the scope of this nested query
// and reusing the defined path and query. | [
"InnerHit",
"sets",
"the",
"inner",
"hit",
"definition",
"in",
"the",
"scope",
"of",
"this",
"nested",
"query",
"and",
"reusing",
"the",
"defined",
"path",
"and",
"query",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_nested.go#L50-L53 | train |
olivere/elastic | search_queries_nested.go | IgnoreUnmapped | func (q *NestedQuery) IgnoreUnmapped(value bool) *NestedQuery {
q.ignoreUnmapped = &value
return q
} | go | func (q *NestedQuery) IgnoreUnmapped(value bool) *NestedQuery {
q.ignoreUnmapped = &value
return q
} | [
"func",
"(",
"q",
"*",
"NestedQuery",
")",
"IgnoreUnmapped",
"(",
"value",
"bool",
")",
"*",
"NestedQuery",
"{",
"q",
".",
"ignoreUnmapped",
"=",
"&",
"value",
"\n",
"return",
"q",
"\n",
"}"
] | // IgnoreUnmapped sets the ignore_unmapped option for the filter that ignores
// unmapped nested fields | [
"IgnoreUnmapped",
"sets",
"the",
"ignore_unmapped",
"option",
"for",
"the",
"filter",
"that",
"ignores",
"unmapped",
"nested",
"fields"
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_nested.go#L57-L60 | train |
olivere/elastic | indices_rollover.go | NewIndicesRolloverService | func NewIndicesRolloverService(client *Client) *IndicesRolloverService {
return &IndicesRolloverService{
client: client,
conditions: make(map[string]interface{}),
settings: make(map[string]interface{}),
mappings: make(map[string]interface{}),
}
} | go | func NewIndicesRolloverService(client *Client) *IndicesRolloverService {
return &IndicesRolloverService{
client: client,
conditions: make(map[string]interface{}),
settings: make(map[string]interface{}),
mappings: make(map[string]interface{}),
}
} | [
"func",
"NewIndicesRolloverService",
"(",
"client",
"*",
"Client",
")",
"*",
"IndicesRolloverService",
"{",
"return",
"&",
"IndicesRolloverService",
"{",
"client",
":",
"client",
",",
"conditions",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
",",
"settings",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
",",
"mappings",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
",",
"}",
"\n",
"}"
] | // NewIndicesRolloverService creates a new IndicesRolloverService. | [
"NewIndicesRolloverService",
"creates",
"a",
"new",
"IndicesRolloverService",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_rollover.go#L38-L45 | train |
olivere/elastic | indices_rollover.go | Alias | func (s *IndicesRolloverService) Alias(alias string) *IndicesRolloverService {
s.alias = alias
return s
} | go | func (s *IndicesRolloverService) Alias(alias string) *IndicesRolloverService {
s.alias = alias
return s
} | [
"func",
"(",
"s",
"*",
"IndicesRolloverService",
")",
"Alias",
"(",
"alias",
"string",
")",
"*",
"IndicesRolloverService",
"{",
"s",
".",
"alias",
"=",
"alias",
"\n",
"return",
"s",
"\n",
"}"
] | // Alias is the name of the alias to rollover. | [
"Alias",
"is",
"the",
"name",
"of",
"the",
"alias",
"to",
"rollover",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_rollover.go#L48-L51 | train |
olivere/elastic | indices_rollover.go | NewIndex | func (s *IndicesRolloverService) NewIndex(newIndex string) *IndicesRolloverService {
s.newIndex = newIndex
return s
} | go | func (s *IndicesRolloverService) NewIndex(newIndex string) *IndicesRolloverService {
s.newIndex = newIndex
return s
} | [
"func",
"(",
"s",
"*",
"IndicesRolloverService",
")",
"NewIndex",
"(",
"newIndex",
"string",
")",
"*",
"IndicesRolloverService",
"{",
"s",
".",
"newIndex",
"=",
"newIndex",
"\n",
"return",
"s",
"\n",
"}"
] | // NewIndex is the name of the rollover index. | [
"NewIndex",
"is",
"the",
"name",
"of",
"the",
"rollover",
"index",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_rollover.go#L54-L57 | train |
olivere/elastic | indices_rollover.go | Timeout | func (s *IndicesRolloverService) Timeout(timeout string) *IndicesRolloverService {
s.timeout = timeout
return s
} | go | func (s *IndicesRolloverService) Timeout(timeout string) *IndicesRolloverService {
s.timeout = timeout
return s
} | [
"func",
"(",
"s",
"*",
"IndicesRolloverService",
")",
"Timeout",
"(",
"timeout",
"string",
")",
"*",
"IndicesRolloverService",
"{",
"s",
".",
"timeout",
"=",
"timeout",
"\n",
"return",
"s",
"\n",
"}"
] | // Timeout sets an explicit operation timeout. | [
"Timeout",
"sets",
"an",
"explicit",
"operation",
"timeout",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_rollover.go#L66-L69 | train |
olivere/elastic | indices_rollover.go | WaitForActiveShards | func (s *IndicesRolloverService) WaitForActiveShards(waitForActiveShards string) *IndicesRolloverService {
s.waitForActiveShards = waitForActiveShards
return s
} | go | func (s *IndicesRolloverService) WaitForActiveShards(waitForActiveShards string) *IndicesRolloverService {
s.waitForActiveShards = waitForActiveShards
return s
} | [
"func",
"(",
"s",
"*",
"IndicesRolloverService",
")",
"WaitForActiveShards",
"(",
"waitForActiveShards",
"string",
")",
"*",
"IndicesRolloverService",
"{",
"s",
".",
"waitForActiveShards",
"=",
"waitForActiveShards",
"\n",
"return",
"s",
"\n",
"}"
] | // WaitForActiveShards sets the number of active shards to wait for on the
// newly created rollover index before the operation returns. | [
"WaitForActiveShards",
"sets",
"the",
"number",
"of",
"active",
"shards",
"to",
"wait",
"for",
"on",
"the",
"newly",
"created",
"rollover",
"index",
"before",
"the",
"operation",
"returns",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_rollover.go#L73-L76 | train |
olivere/elastic | indices_rollover.go | DryRun | func (s *IndicesRolloverService) DryRun(dryRun bool) *IndicesRolloverService {
s.dryRun = dryRun
return s
} | go | func (s *IndicesRolloverService) DryRun(dryRun bool) *IndicesRolloverService {
s.dryRun = dryRun
return s
} | [
"func",
"(",
"s",
"*",
"IndicesRolloverService",
")",
"DryRun",
"(",
"dryRun",
"bool",
")",
"*",
"IndicesRolloverService",
"{",
"s",
".",
"dryRun",
"=",
"dryRun",
"\n",
"return",
"s",
"\n",
"}"
] | // DryRun, when set, specifies that only conditions are checked without
// performing the actual rollover. | [
"DryRun",
"when",
"set",
"specifies",
"that",
"only",
"conditions",
"are",
"checked",
"without",
"performing",
"the",
"actual",
"rollover",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_rollover.go#L86-L89 | train |
olivere/elastic | indices_rollover.go | Conditions | func (s *IndicesRolloverService) Conditions(conditions map[string]interface{}) *IndicesRolloverService {
s.conditions = conditions
return s
} | go | func (s *IndicesRolloverService) Conditions(conditions map[string]interface{}) *IndicesRolloverService {
s.conditions = conditions
return s
} | [
"func",
"(",
"s",
"*",
"IndicesRolloverService",
")",
"Conditions",
"(",
"conditions",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"*",
"IndicesRolloverService",
"{",
"s",
".",
"conditions",
"=",
"conditions",
"\n",
"return",
"s",
"\n",
"}"
] | // Conditions allows to specify all conditions as a dictionary. | [
"Conditions",
"allows",
"to",
"specify",
"all",
"conditions",
"as",
"a",
"dictionary",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_rollover.go#L92-L95 | train |
olivere/elastic | indices_rollover.go | AddCondition | func (s *IndicesRolloverService) AddCondition(name string, value interface{}) *IndicesRolloverService {
s.conditions[name] = value
return s
} | go | func (s *IndicesRolloverService) AddCondition(name string, value interface{}) *IndicesRolloverService {
s.conditions[name] = value
return s
} | [
"func",
"(",
"s",
"*",
"IndicesRolloverService",
")",
"AddCondition",
"(",
"name",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"*",
"IndicesRolloverService",
"{",
"s",
".",
"conditions",
"[",
"name",
"]",
"=",
"value",
"\n",
"return",
"s",
"\n",
"}"
] | // AddCondition adds a condition to the rollover decision. | [
"AddCondition",
"adds",
"a",
"condition",
"to",
"the",
"rollover",
"decision",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_rollover.go#L98-L101 | train |
olivere/elastic | indices_rollover.go | AddMaxIndexAgeCondition | func (s *IndicesRolloverService) AddMaxIndexAgeCondition(time string) *IndicesRolloverService {
s.conditions["max_age"] = time
return s
} | go | func (s *IndicesRolloverService) AddMaxIndexAgeCondition(time string) *IndicesRolloverService {
s.conditions["max_age"] = time
return s
} | [
"func",
"(",
"s",
"*",
"IndicesRolloverService",
")",
"AddMaxIndexAgeCondition",
"(",
"time",
"string",
")",
"*",
"IndicesRolloverService",
"{",
"s",
".",
"conditions",
"[",
"\"",
"\"",
"]",
"=",
"time",
"\n",
"return",
"s",
"\n",
"}"
] | // AddMaxIndexAgeCondition adds a condition to set the max index age. | [
"AddMaxIndexAgeCondition",
"adds",
"a",
"condition",
"to",
"set",
"the",
"max",
"index",
"age",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_rollover.go#L104-L107 | train |
olivere/elastic | indices_rollover.go | AddMaxIndexDocsCondition | func (s *IndicesRolloverService) AddMaxIndexDocsCondition(docs int64) *IndicesRolloverService {
s.conditions["max_docs"] = docs
return s
} | go | func (s *IndicesRolloverService) AddMaxIndexDocsCondition(docs int64) *IndicesRolloverService {
s.conditions["max_docs"] = docs
return s
} | [
"func",
"(",
"s",
"*",
"IndicesRolloverService",
")",
"AddMaxIndexDocsCondition",
"(",
"docs",
"int64",
")",
"*",
"IndicesRolloverService",
"{",
"s",
".",
"conditions",
"[",
"\"",
"\"",
"]",
"=",
"docs",
"\n",
"return",
"s",
"\n",
"}"
] | // AddMaxIndexDocsCondition adds a condition to set the max documents in the index. | [
"AddMaxIndexDocsCondition",
"adds",
"a",
"condition",
"to",
"set",
"the",
"max",
"documents",
"in",
"the",
"index",
"."
] | 0534a7b1bf47b1ccf57e905491a641709f8a623d | https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_rollover.go#L110-L113 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.