db/opensearch
An OpenSearch client: documents, bulk, the query DSL, aggregations, scroll and point in time, index admin, SQL and PPL, k-NN vector search, ISM, security and AWS signing.
import db.opensearch
OpenSearch is an open source search and analytics engine. This package speaks its REST API directly over net.tcp and tls, with no outside library: several nodes with retries and dead node skipping, basic, bearer and AWS SigV4 authentication (for Amazon OpenSearch Service and Serverless), and TLS with your own CA file or, for a test server, no verification. On top of that it covers documents, bulk, every common query and aggregation, scroll and point in time paging, index, alias, template and data stream admin, cluster, task, snapshot and pipeline admin, and the plugins that make OpenSearch what it is: SQL and PPL, k-NN and neural search, hybrid search pipelines, ISM policies, the security plugin, alerting monitors and ML Commons.
Queries, aggregations and request bodies are plain JSON text: the builders such as Match, BoolOf and TermsAgg return it, and anything they do not cover can be written as a backtick string. Results come back as Salam structs whose JSON parts (a hit's source, the aggregations) are raw text you read with Buckets, AggValue and JsonPath. Every call records its status and error on the client, so read Error or ErrorType after a call that returned false. Conn boxes a client as a db.Connection, so SQL code written for the other engines can query OpenSearch too. For a route with no function of its own, use Perform. Only the examples for the query builders and request signing run here; the others need a server, so they are only checked.
db/elasticsearch also talks to the OpenSearch core API. Use this package when you need what only OpenSearch has: PPL, k-NN, neural and hybrid search, ISM, the security plugin, alerting, ML Commons, or AWS SigV4 for Amazon OpenSearch Service and Serverless.
Types
BoolQuery
struct BoolQueryBoolOf.| Name | Type | Description |
|---|---|---|
must | Vector | Must match and adds to the score. |
filter | Vector | Must match, but does not score; cached. |
should | Vector | Should match; raises the score. |
must_not | Vector | Must not match. |
minimum_should_match | str = "" | How many should clauses must match, such as 1 or 75%. |
boost | f64 = 0 | Multiplies the score; 0 leaves it out. |
import db.opensearch
func list(a: str, b: str): Vector<str>:
mut v := Vector {} as Vector<str>
v.push(a)
if b.len() > 0: v.push(b) end
ret v
end
func main:
println opensearch.MatchAll(), opensearch.MatchNone()
println opensearch.Match("title", "salam"), opensearch.MatchAnd("title", "salam world")
println opensearch.MatchFuzzy("title", "slam"), opensearch.MatchPhrase("title", "hello world")
println opensearch.MatchPhraseSlop("title", "hello world", 2), opensearch.MatchPhrasePrefix("title", "sal")
println opensearch.MatchBoolPrefix("title", "quick bro")
println opensearch.MultiMatch("salam", list("title^2", "body")), opensearch.MultiMatchType("salam", list("title", "body"), "phrase")
println opensearch.Term("tag", "news"), opensearch.TermInt("year", 1403), opensearch.TermBool("published", true)
println opensearch.TermCaseInsensitive("tag", "News"), opensearch.Terms("tag", list("news", "sport"))
mut years := Vector {} as Vector<i64>
years.push(1402)
years.push(1403)
println opensearch.TermsInt("year", years), opensearch.TermsLookup("tag", "users", "7", "follows")
println opensearch.TermsSet("skills", list("go", "salam"), "required")
println opensearch.Range("date", "2026-01-01", "2026-12-31"), opensearch.RangeExclusive("price", "10", "20")
println opensearch.RangeNum("price", 9.5, 20.0), opensearch.RangeInt("stock", 1, 100), opensearch.RangeOp("price", "lt", "5")
println opensearch.DateRange("at", "now-7d/d", "now", "", "+03:30")
println opensearch.FieldExists("email"), opensearch.Prefix("sku", "AB-"), opensearch.Wildcard("sku", "AB-*-9")
println opensearch.Regexp("sku", "AB-[0-9]+"), opensearch.Fuzzy("name", "maryem"), opensearch.Ids(list("1", "2"))
println opensearch.QueryString("title:salam AND year:1403")
println opensearch.QueryStringFields("salam world", list("title", "body"), "AND")
println opensearch.SimpleQueryString("salam -draft", list("title", ""))
mut b := opensearch.BoolQuery { minimum_should_match = "1", boost = 1.5 }
b.must.push(opensearch.Match("title", "salam"))
b.filter.push(opensearch.Term("status", "published"))
b.should.push(opensearch.Term("tag", "featured"))
b.must_not.push(opensearch.Term("tag", "spam"))
println opensearch.BoolOf(b)
println opensearch.Bool(list(opensearch.Match("t", "x"), ""), list(opensearch.Term("a", "1"), ""), Vector {} as Vector<str>, Vector {} as Vector<str>)
println opensearch.And(list(opensearch.Term("a", "1"), opensearch.Term("b", "2")))
println opensearch.Or(list(opensearch.Term("a", "1"), opensearch.Term("b", "2"))), opensearch.Not(opensearch.Term("a", "1"))
println opensearch.Filtered(opensearch.Match("t", "x"), list(opensearch.Term("a", "1"), ""))
println opensearch.ConstantScore(opensearch.Term("tag", "news"), 1.2)
println opensearch.DisMax(list(opensearch.Match("title", "x"), opensearch.Match("body", "x")), 0.3)
println opensearch.Boosting(opensearch.Match("t", "apple"), opensearch.Match("t", "pie"), 0.5)
println opensearch.Nested("comments", opensearch.Match("comments.text", "great"))
println opensearch.HasChild("answer", opensearch.MatchAll()), opensearch.HasParent("question", opensearch.MatchAll())
println opensearch.MoreLikeThis(list("title", "body"), "search engines in Salam")
println opensearch.ScriptQuery("doc['stock'].value > params.min", `{"min":5}`)
println opensearch.ScriptScore(opensearch.MatchAll(), "_score * doc['rank'].value", "")
println opensearch.FunctionScore(opensearch.Match("t", "x"), list(opensearch.FieldValueFactor("likes", 1.2, "log1p"), ""), "sum", "multiply")
println opensearch.GeoDistance("location", 35.69, 51.39, "5km")
println opensearch.GeoBoundingBox("location", 36.0, 51.0, 35.5, 51.8)
mut v := Vector {} as Vector<f64>
v.push(0.12)
v.push(-0.5)
v.push(0.9)
println opensearch.Knn("embedding", v, 10), opensearch.KnnVector(v)
println opensearch.KnnFiltered("embedding", v, 10, opensearch.Term("lang", "fa"))
println opensearch.KnnRadial("embedding", v, 0.5), opensearch.KnnMinScore("embedding", v, 0.8)
println opensearch.Neural("embedding", "a cosy cafe", "model-1", 5), opensearch.NeuralSparse("tokens", "a cosy cafe", "model-2")
println opensearch.Hybrid(list(opensearch.Match("text", "cafe"), opensearch.Neural("embedding", "cafe", "model-1", 5)))
println opensearch.SortAsc("price"), opensearch.SortDesc("date"), opensearch.SortScore()
println opensearch.SortGeo("location", 35.69, 51.39, "km")
println opensearch.Highlight(list("title", "body")), opensearch.HighlightTags(list("title", ""), "<mark>", "</mark>")
println opensearch.Collapse("author"), opensearch.TermSuggest("fix", "salm", "title")
println opensearch.CompletionSuggest("auto", "sal", "title.suggest", 5)
mut aggs := opensearch.AddAgg("{}", "tags", opensearch.TermsAgg("tag", 10))
aggs = opensearch.AddAgg(aggs, "avg_price", opensearch.AvgAgg("price"))
aggs = opensearch.AddAgg(aggs, "total", opensearch.SumAgg("price"))
aggs = opensearch.AddAgg(aggs, "cheapest", opensearch.MinAgg("price"))
aggs = opensearch.AddAgg(aggs, "dearest", opensearch.MaxAgg("price"))
aggs = opensearch.AddAgg(aggs, "priced", opensearch.ValueCountAgg("price"))
aggs = opensearch.AddAgg(aggs, "authors", opensearch.CardinalityAgg("author"))
println aggs
mut pcts := Vector {} as Vector<f64>
pcts.push(50.0)
pcts.push(99.0)
println opensearch.StatsAgg("price"), opensearch.ExtendedStatsAgg("price"), opensearch.PercentilesAgg("ms", pcts)
println opensearch.HistogramAgg("price", 10.0), opensearch.RangeAgg("price", pcts)
monthly := opensearch.SubAggs(opensearch.DateHistogramAgg("date", "month"), opensearch.AddAgg("{}", "sales", opensearch.SumAgg("price")))
println monthly
println opensearch.FilterAgg(opensearch.Term("tag", "news")), opensearch.NestedAgg("comments"), opensearch.MissingAgg("price")
println opensearch.TopHitsAgg(3), opensearch.CompositeAgg(list("tag", "author"), 100)
println opensearch.AddMember(`{"size":0}`, "aggs", aggs)
mut req := opensearch.SearchRequest { query = opensearch.BoolOf(b), from = 0, size = 20, track_total_hits = "true" }
req.sort.push(opensearch.SortDesc("date"))
req.source.push("title")
req.source_excludes.push("body")
req.fields.push("date")
req.docvalue_fields.push("price")
req.aggs = aggs
req.highlight = opensearch.Highlight(list("title", ""))
req.post_filter = opensearch.Term("color", "red")
req.collapse = opensearch.Collapse("author")
req.suggest = opensearch.TermSuggest("fix", "salm", "title")
req.rescore = `{"window_size":50,"query":{"rescore_query":{"match_phrase":{"title":"salam"}}}}`
req.script_fields = `{"double":{"script":{"source":"doc['price'].value * 2"}}}`
req.search_after = `[1700000000000]`
req.track_scores = true
req.min_score = "0.1"
req.timeout = "2s"
req.explain = false
req.version = true
req.seq_no_primary_term = true
req.ext = `{"rag":{"llm_question":"why"}}`
req.extra.push(`"profile":false`)
println opensearch.SearchBody(req)
println opensearch.SearchBody(opensearch.SearchRequest { query = opensearch.MatchAll(), pit_id = "PIT", pit_keep_alive = "1m", no_source = true })
endSearchParams
struct SearchParams| Name | Type | Description |
|---|---|---|
routing | str = "" | Search only the shards for this routing value. |
preference | str = "" | Which shard copies to prefer, such as _local. |
search_pipeline | str = "" | A search pipeline to run, such as one for hybrid search. |
search_type | str = "" | query_then_fetch or dfs_query_then_fetch. |
scroll | str = "" | Keep a scroll open this long. |
request_cache | str = "" | true or false: use the request cache. |
allow_partial_search_results | str = "" | false fails the search when a shard fails. |
ignore_unavailable | bool = false | Skip missing or closed indices. |
import db.opensearch
func main:
c := opensearch.Connect("http://localhost:9200")
mut req := opensearch.SearchRequest { query = opensearch.Match("title", "kings"), size = 10 }
req.sort.push(opensearch.SortDesc("year"))
req.aggs = opensearch.AddAgg(opensearch.AddAgg("{}", "by_tag", opensearch.TermsAgg("tag", 5)), "avg_year", opensearch.AvgAgg("year"))
req.aggs = opensearch.AddAgg(req.aggs, "stats", opensearch.StatsAgg("year"))
req.suggest = opensearch.TermSuggest("fix", "kngs", "title")
r := opensearch.SearchWith(c, "books", req)
println r.ok, r.status, r.took, r.timed_out, r.total, r.total_relation, r.max_score, r.error
each h in r.hits:
println h.index, h.id, h.score, h.source, h.sort, h.highlight, h.fields, h.inner_hits, h.matched_queries, h.raw.len()
end
each bk in opensearch.Buckets(r.aggregations, "by_tag"):
println bk.key, bk.key_as_string, bk.doc_count, bk.raw.len()
end
println opensearch.AggValue(r.aggregations, "avg_year"), opensearch.AggField(r.aggregations, "stats", "max")
println opensearch.AggRaw(r.aggregations, "stats"), opensearch.Suggestions(r.suggest, "fix")
println opensearch.Search(c, "books,articles", opensearch.MatchAll()).total
println opensearch.SearchRaw(c, "books", `{"query":{"match_all":{}},"size":1}`).hits.len()
p := opensearch.SearchParams {
routing = "poetry", preference = "_local", search_pipeline = "rerank", search_type = "dfs_query_then_fetch",
request_cache = "true", allow_partial_search_results = "false", ignore_unavailable = true
}
println opensearch.SearchParamsWith(c, "books", `{"size":0}`, p).total, p.scroll.len()
parsed := opensearch.ParseSearch(r.raw)
println parsed.hits.len(), parsed.scroll_id, parsed.pit_id
mut page := opensearch.SearchScroll(c, "books", opensearch.SearchRequest { query = opensearch.MatchAll(), size = 500 }, "1m")
mut seen := 0
until page.hits.len() > 0:
seen += page.hits.len()
page = opensearch.Scroll(c, page.scroll_id, "1m")
end
println seen, opensearch.ClearScroll(c, page.scroll_id)
pit := opensearch.CreatePit(c, "books", "2m")
mut preq := opensearch.SearchRequest { query = opensearch.MatchAll(), size = 100, pit_id = pit, pit_keep_alive = "2m" }
preq.sort.push(opensearch.SortAsc("year"))
mut pp := opensearch.SearchWith(c, "", preq)
until pp.hits.len() > 0:
preq.search_after = pp.hits.get(pp.hits.len() - 1).sort
pp = opensearch.SearchWith(c, "", preq)
end
println opensearch.ListPits(c), opensearch.DeletePit(c, pit), opensearch.DeleteAllPits(c)
mut bodies := Vector {} as Vector<str>
bodies.push(`{"query":{"term":{"tag":"poetry"}},"size":0}`)
bodies.push(`{"query":{"match_all":{}},"size":0}`)
each one in opensearch.MSearch(c, "books", bodies):
println one.ok, one.total
end
println opensearch.SearchTemplate(c, "books", "by_tag", `{"tag":"poetry"}`).total
println opensearch.SearchInlineTemplate(c, "books", `{"query":{"term":{"tag":"{{t}}"}}}`, `{"t":"poetry"}`).total
println opensearch.RenderTemplate(c, `{"query":{"term":{"tag":"{{t}}"}}}`, `{"t":"poetry"}`)
println opensearch.Explain(c, "books", "1", opensearch.Match("title", "kings"))
println opensearch.Validate(c, "books", opensearch.Match("title", "kings"))
mut fields := Vector {} as Vector<str>
fields.push("title")
println opensearch.FieldCaps(c, "books", fields)
println opensearch.JsonPath(r.raw, "hits.hits.0._source.title"), opensearch.JsonPathRaw(r.raw, "hits.total")
println opensearch.JsonItems(`[1,"two",{"three":3}]`).len()
endTaskInfo
struct TaskInfo| Name | Type | Description |
|---|---|---|
ok | bool = false | The request succeeded and the task did not fail. |
id | str = "" | The task id, node:number. |
completed | bool = false | It has finished. |
action | str = "" | What it does, such as indices:data/write/reindex. |
description | str = "" | A description. |
status | str = "" | Its progress as raw JSON. |
response | str = "" | Its result as raw JSON, once completed. |
error | str = "" | What went wrong. |
import db.opensearch
func main:
c := opensearch.Connect("http://localhost:9200")
h := opensearch.ClusterHealth(c)
println h.ok, h.cluster_name, h.status, h.timed_out, h.nodes, h.data_nodes, h.active_primary_shards
println h.active_shards, h.relocating_shards, h.initializing_shards, h.unassigned_shards, h.pending_tasks, h.active_shards_percent
println opensearch.WaitForStatus(c, "books", "yellow", "30s").status
println opensearch.ClusterStats(c).len() > 0, opensearch.ClusterState(c, "metadata").len() > 0
println opensearch.PutClusterSettings(c, `{"cluster.routing.allocation.enable":"all"}`, "")
println opensearch.GetClusterSettings(c)
println opensearch.AllocationExplain(c, `{"index":"books","shard":0,"primary":true}`).len()
println opensearch.NodesInfo(c, "os").len() > 0, opensearch.NodesStats(c, "jvm").len() > 0, opensearch.HotThreads(c).len() > 0
each row in opensearch.Cat(c, "shards?h=index,shard,state"):
println row
end
println opensearch.CatText(c, "nodes"), opensearch.Plugins(c), opensearch.HasPlugin(c, "opensearch-knn")
rx := opensearch.ReindexBody(c, `{"source":{"index":"books"},"dest":{"index":"books_v4"}}`, false)
t := opensearch.GetTask(c, rx.task)
println t.ok, t.id, t.completed, t.action, t.description, t.status, t.response, t.error
println opensearch.WaitTask(c, rx.task, "60s").completed, opensearch.CancelTask(c, rx.task)
println opensearch.ListTasks(c, "*reindex").len() > 0
println opensearch.PutRepository(c, "backups", "fs", `{"location":"/mnt/backups"}`), opensearch.VerifyRepository(c, "backups")
println opensearch.GetRepository(c, "backups"), opensearch.CreateSnapshot(c, "backups", "nightly-1", "books", true)
println opensearch.Snapshots(c, "backups"), opensearch.GetSnapshot(c, "backups", "nightly-1").len() > 0
println opensearch.SnapshotStatus(c, "backups", "nightly-1").len() > 0
println opensearch.RestoreSnapshot(c, "backups", "nightly-1", `{"indices":"books","rename_pattern":"(.+)","rename_replacement":"restored_$1"}`, true)
println opensearch.DeleteSnapshot(c, "backups", "nightly-1"), opensearch.DeleteRepository(c, "backups")
mut procs := Vector {} as Vector<str>
procs.push(opensearch.Processor("lowercase", `{"field":"tag"}`))
procs.push(opensearch.Processor("set", `{"field":"seen","value":true}`))
println opensearch.PutPipeline(c, "clean", opensearch.Pipeline("tidy incoming books", procs))
mut docs := Vector {} as Vector<str>
docs.push(`{"tag":"POETRY"}`)
println opensearch.SimulatePipeline(c, "clean", docs), opensearch.GetPipeline(c, "clean").len() > 0
println opensearch.DeletePipeline(c, "clean")
println opensearch.PutScript(c, "double", "doc['stock'].value * 2"), opensearch.GetScript(c, "double")
println opensearch.PutSearchTemplate(c, "by_tag", `{"query":{"term":{"tag":"{{tag}}"}}}`), opensearch.DeleteScript(c, "by_tag"), opensearch.DeleteScript(c, "double")
endAuthInfo
struct AuthInfo| Name | Type | Description |
|---|---|---|
ok | bool = false | The request succeeded. |
user | str = "" | The user name. |
roles | Vector | The security roles. |
backend_roles | Vector | The backend roles. |
tenants | Vector | The tenants the user may use. |
error | str = "" | What went wrong. |
import db.opensearch
func main:
c := opensearch.ConnectInsecure("https://localhost:9200", "admin", "S3cret-pass!")
mut patterns := Vector {} as Vector<str>
patterns.push("logs-*")
println opensearch.PutPolicy(c, "logs-30d", opensearch.DeleteAfterPolicy("drop old logs", "30d", patterns))
println opensearch.GetPolicy(c, "logs-30d").len() > 0
println opensearch.UpdatePolicy(c, "logs-30d", opensearch.DeleteAfterPolicy("drop old logs", "60d", patterns), 0 as i64, 1 as i64)
println opensearch.AddPolicy(c, "logs-000001", "logs-30d"), opensearch.PolicyIdOf(c, "logs-000001")
println opensearch.ChangePolicy(c, "logs-000001", "logs-30d", "hot"), opensearch.RetryPolicy(c, "logs-000001")
println opensearch.ExplainPolicy(c, "logs-000001"), opensearch.RemovePolicy(c, "logs-000001"), opensearch.DeletePolicy(c, "logs-30d")
me := opensearch.WhoAmI(c)
println me.ok, me.user, me.roles, me.backend_roles, me.tenants, me.error
println opensearch.SecurityHealth(c)
mut perms := Vector {} as Vector<str>
perms.push("cluster_monitor")
mut actions := Vector {} as Vector<str>
actions.push("read")
println opensearch.PutRole(c, "logs_reader", opensearch.RoleBody(perms, patterns, actions)), opensearch.GetRole(c, "logs_reader")
println opensearch.PutUser(c, "maryam", "Strong-Pass-1!", Vector {} as Vector<str>, `{"team":"ops"}`), opensearch.GetUser(c, "maryam")
mut users := Vector {} as Vector<str>
users.push("maryam")
println opensearch.PutRoleMapping(c, "logs_reader", users, Vector {} as Vector<str>), opensearch.GetRoleMapping(c, "logs_reader")
println opensearch.Users(c), opensearch.ChangePassword(c, "S3cret-pass!", "N3w-secret-pass!")
println opensearch.DeleteRoleMapping(c, "logs_reader"), opensearch.DeleteUser(c, "maryam"), opensearch.DeleteRole(c, "logs_reader")
monitor := `{"type":"monitor","name":"errors","enabled":true,"schedule":{"period":{"interval":5,"unit":"MINUTES"}},"inputs":[{"search":{"indices":["logs-*"],"query":{"size":0,"query":{"match":{"level":"error"}}}}}],"triggers":[]}`
id := opensearch.CreateMonitor(c, monitor)
println id, opensearch.GetMonitor(c, id).len() > 0, opensearch.UpdateMonitor(c, id, monitor)
println opensearch.ExecuteMonitor(c, id, true).len() > 0, opensearch.SearchMonitors(c, opensearch.MatchAll()).total
println opensearch.DeleteMonitor(c, id)
endKnnMethod
struct KnnMethodknn_vector field is indexed.| Name | Type | Description |
|---|---|---|
name | str = "hnsw" | The algorithm, hnsw or ivf. |
engine | str = "lucene" | lucene, faiss or nmslib. |
space_type | str = "l2" | The distance: l2, cosinesimil, innerproduct and others, depending on the engine. |
m | int = 0 | The HNSW link count; 0 for the default. |
ef_construction | int = 0 | The HNSW build quality; 0 for the default. |
import db.opensearch
func main:
c := opensearch.Connect("http://localhost:9200")
method := opensearch.KnnMethod { name = "hnsw", engine = "lucene", space_type = "cosinesimil", m = 16, ef_construction = 128 }
mut extra := Vector {} as Vector<str>
extra.push(opensearch.Property("text", "text"))
println opensearch.KnnIndexSettings(1, 0), opensearch.KnnVectorField(3, method)
println opensearch.CreateIndex(c, "places", opensearch.KnnIndexBody("embedding", 3, method, extra))
opensearch.Index(c, "places", "1", `{"text":"a cafe","embedding":[0.1,0.9,0.2]}`)
opensearch.Refresh(c, "places")
mut v := Vector {} as Vector<f64>
v.push(0.1)
v.push(0.8)
v.push(0.3)
r := opensearch.Search(c, "places", opensearch.Knn("embedding", v, 5))
println r.total
println opensearch.KnnWarmup(c, "places"), opensearch.KnnClearCache(c, "places"), opensearch.KnnStats(c).len() > 0
println opensearch.KnnTrainModel(c, "pq-model", `{"training_index":"train","training_field":"v","dimension":3,"method":{"name":"ivf","engine":"faiss"}}`)
println opensearch.KnnGetModel(c, "pq-model"), opensearch.KnnDeleteModel(c, "pq-model")
mut w := Vector {} as Vector<f64>
w.push(0.3)
w.push(0.7)
println opensearch.PutSearchPipeline(c, "hybrid", opensearch.NormalizationPipeline("min_max", "arithmetic_mean", w))
println opensearch.GetSearchPipeline(c, "hybrid"), opensearch.DeleteSearchPipeline(c, "hybrid")
task := opensearch.MlRegisterModel(c, `{"name":"huggingface/sentence-transformers/all-MiniLM-L6-v2","version":"1.0.1","model_format":"TORCH_SCRIPT"}`)
println opensearch.MlGetTask(c, task)
println opensearch.MlDeployModel(c, "model-1"), opensearch.MlGetModel(c, "model-1").len() > 0
println opensearch.MlPredict(c, "text_embedding", "model-1", `{"text_docs":["salam"]}`)
println opensearch.MlUndeployModel(c, "model-1"), opensearch.MlDeleteModel(c, "model-1")
endByQueryResult
struct ByQueryResult| Name | Type | Description |
|---|---|---|
ok | bool = false | It finished with no failures. |
status | int = 0 | The HTTP status. |
took | i64 = 0 | How long it took, in milliseconds. |
timed_out | bool = false | It ran out of time. |
total | i64 = 0 | How many documents it looked at. |
created | i64 = 0 | How many it created. |
updated | i64 = 0 | How many it updated. |
deleted | i64 = 0 | How many it deleted. |
batches | i64 = 0 | How many scroll batches it took. |
version_conflicts | i64 = 0 | How many hit a version conflict. |
noops | i64 = 0 | How many a script left unchanged. |
failures | str = "" | The failures as raw JSON; empty when there were none. |
task | str = "" | The task id, when it runs in the background. |
error | str = "" | What went wrong. |
import db.opensearch
func main:
c := opensearch.Connect("http://localhost:9200")
w := opensearch.Index(c, "books", "1", `{"title":"The Book of Kings","year":1010,"stock":3}`)
println w.ok, w.status, w.index, w.id, w.result, w.version, w.seq_no, w.primary_term
println w.shards_total, w.shards_successful, w.error
auto := opensearch.IndexWith(c, "books", "", `{"title":"Masnavi"}`, opensearch.Options { refresh = opensearch.REFRESH_WAIT_FOR, routing = "poetry" })
println auto.id
dup := opensearch.Create(c, "books", "1", `{"title":"again"}`)
println dup.ok, dup.status
piped := opensearch.CreateWith(c, "books", "2", `{"title":"Golestan"}`, opensearch.Options { pipeline = "clean", timeout = "5s", wait_for_active_shards = "1" })
println piped.result
d := opensearch.Get(c, "books", "1")
println d.found, d.index, d.id, d.version, d.seq_no, d.primary_term, d.routing, d.source, d.fields, d.error
mut only := Vector {} as Vector<str>
only.push("title")
println opensearch.GetFields(c, "books", "1", only, "").source
println opensearch.GetSource(c, "books", "1"), opensearch.Exists(c, "books", "1")
println opensearch.Update(c, "books", "1", `{"stock":2}`).result
cas := opensearch.UpdateWith(c, "books", "1", `{"doc":{"stock":1}}`, opensearch.Options { if_seq_no = d.seq_no, if_primary_term = d.primary_term, retry_on_conflict = -1 })
println cas.ok, opensearch.ErrorType(c)
println opensearch.Upsert(c, "books", "9", `{"title":"Shahnameh","stock":1}`).result
println opensearch.UpdateScript(c, "books", "1", opensearch.Script("ctx._source.stock += params.n", `{"n":5}`), `{"stock":5}`).result
println opensearch.DeleteWith(c, "books", "9", opensearch.Options { refresh = opensearch.REFRESH_TRUE, version = 3, version_type = "external" }).result
println opensearch.Delete(c, "books", "2").result
mut ids := Vector {} as Vector<str>
ids.push("1")
ids.push("404")
each doc in opensearch.MGet(c, "books", ids):
println doc.id, doc.found
end
println opensearch.Count(c, "books", ""), opensearch.Count(c, "books", opensearch.Range("year", "1000", ""))
mut b := opensearch.NewBulk()
opensearch.BulkIndex(b, "books", "10", `{"title":"Divan"}`)
opensearch.BulkIndexRouted(b, "books", "11", "poetry", `{"title":"Rubaiyat"}`)
opensearch.BulkCreate(b, "books", "", `{"title":"Bustan"}`)
opensearch.BulkUpdate(b, "books", "10", `{"stock":4}`)
opensearch.BulkUpsert(b, "books", "12", `{"title":"Kalila"}`)
opensearch.BulkDelete(b, "books", "3")
println opensearch.BulkLen(b), b.count, b.lines.len()
print opensearch.BulkBody(b)
br := opensearch.BulkSendWith(c, b, opensearch.REFRESH_FALSE)
println br.ok, br.status, br.took, br.errors, br.succeeded, br.failed, br.error
each it in br.items:
println it.action, it.index, it.id, it.status, it.ok, it.result, it.version, it.error_type, it.error_reason
end
opensearch.BulkReset(b)
opensearch.BulkIndex(b, "books", "13", `{"title":"Makhzan"}`)
println opensearch.BulkSend(c, b).ok
opensearch.BulkFree(b)
println opensearch.ParseBulk(`{"took":1,"errors":false,"items":[]}`).ok
ub := opensearch.UpdateByQuery(c, "books", opensearch.Term("stock", "0"), opensearch.Script("ctx._source.out = true", ""))
println ub.ok, ub.status, ub.took, ub.timed_out, ub.total, ub.updated, ub.batches, ub.version_conflicts, ub.noops, ub.failures
ub2 := opensearch.UpdateByQueryWith(c, "books", "", "", opensearch.Options { conflicts = "proceed", pipeline = "clean" })
println ub2.updated
dq := opensearch.DeleteByQuery(c, "books", opensearch.Term("out", "true"))
println dq.deleted, opensearch.DeleteByQueryWith(c, "books", opensearch.MatchAll(), opensearch.Options { refresh = "true", conflicts = "proceed" }).deleted
rx := opensearch.Reindex(c, "books", "books_v2")
println rx.created, rx.error
task := opensearch.ReindexBody(c, `{"source":{"index":"books"},"dest":{"index":"books_v3"}}`, false)
println task.task
endConfig
struct ConfigNewClient needs.| Name | Type | Description |
|---|---|---|
nodes | Vector | Node urls; each entry may hold several separated by commas, and a url may carry user:password@ and a path prefix. |
username | str = "" | The user for basic authentication. |
password | str = "" | The password for basic authentication. |
bearer | str = "" | A bearer token, sent instead of basic authentication. |
ca_file | str = "" | A PEM file of the certificate authorities to trust for https. |
insecure | bool = false | Skip certificate checks; only for a test server with a self signed certificate. |
timeout_ms | int = 30000 | How long one request may take, in milliseconds; 0 for no limit. |
max_retries | int = 3 | How many more times a request is tried on another node after a failed connection or a 502, 503 or 504. |
headers | HashMap | Extra headers sent with every request. |
aws_region | str = "" | Sign every request with AWS SigV4 for this region; empty for no signing. |
aws_service | str = "" | The AWS service to sign for, SERVICE_ES (the default) or SERVICE_AOSS. |
aws_access_key | str = "" | The AWS access key id. |
aws_secret_key | str = "" | The AWS secret access key. |
aws_session_token | str = "" | The AWS session token for temporary credentials; empty if none. |
import db.opensearch
func main:
mut cfg := opensearch.DefaultConfig()
cfg.nodes.push("https://node2.example.com:9200, https://node3.example.com:9200")
cfg.username = "admin"
cfg.password = "S3cret-pass!"
cfg.ca_file = "/etc/ssl/certs/opensearch-ca.pem"
cfg.timeout_ms = 10000
cfg.max_retries = 2
cfg.headers.put("X-Opaque-Id", "shop-api")
mut c := opensearch.NewClient(cfg)
if not opensearch.Ok(c):
println opensearch.Error(c)
ret 1
end
println opensearch.Nodes(c), opensearch.AuthHeader(c).len() > 0, opensearch.VERSION
println opensearch.Ping(c)
info := opensearch.GetInfo(c)
println info.ok, info.name, info.cluster_name, info.cluster_uuid, info.version, info.distribution
println info.build_type, info.lucene_version, info.minimum_wire_compatibility_version, info.tagline
r := opensearch.Perform(c, "GET", "/_cat/health?format=json", "")
println r.ok, r.status, r.body
if not r.ok:
println r.error, r.error_type, r.error_reason
end
nd := opensearch.PerformNdjson(c, "POST", "/_bulk", "{\"delete\":{\"_index\":\"shop\",\"_id\":\"1\"}}\n")
println nd.status, opensearch.Status(c), opensearch.ErrorType(c), opensearch.ErrorReason(c)
txt := opensearch.PerformText(c, "POST", "/_plugins/_sql?format=csv", `{"query":"SELECT 1"}`, "application/json")
println txt.body
opensearch.Close(c)
mut local := opensearch.Connect(opensearch.DEFAULT_URL)
println opensearch.Ok(local), opensearch.DEFAULT_PORT, opensearch.DEAD_NODE_MS
opensearch.Close(local)
mut demo := opensearch.ConnectInsecure("https://localhost:9200", "admin", "S3cret-pass!")
opensearch.Close(demo)
mut auth := opensearch.ConnectAuth("https://search.example.com", "reader", "pass")
println opensearch.EncodeBasic("reader", "pass")
opensearch.Close(auth)
mut aws := opensearch.ConnectAWS(
"https://search-shop.eu-west-1.es.amazonaws.com", "eu-west-1", opensearch.SERVICE_ES,
"AKIAEXAMPLE", "secret-key", ""
)
opensearch.SetSigningTime(aws, 1700000000 as i64)
println opensearch.ClusterHealth(aws).status
opensearch.Close(aws)
mut serverless := opensearch.ConnectAWS(
"https://abc123.eu-west-1.aoss.amazonaws.com", "eu-west-1", opensearch.SERVICE_AOSS,
"AKIAEXAMPLE", "secret-key", "session-token"
)
opensearch.Close(serverless)
ret 0
endClient
struct ClientClose.| Name | Type | Description |
|---|---|---|
handle | void* | The internal state. |
The example for this item is shown with the ones above: db-opensearch-Client.salam
Response
struct Response| Name | Type | Description |
|---|---|---|
status | int = 0 | The HTTP status; 0 when no answer came. |
ok | bool = false | The status was 2xx. |
body | str = "" | The response body. |
error | str = "" | What went wrong, with the server's error type and reason when it sent them. |
error_type | str = "" | The server's error type, such as index_not_found_exception. |
error_reason | str = "" | The server's error reason. |
The example for this item is shown with the ones above: db-opensearch-Client.salam
Options
struct Options| Name | Type | Description |
|---|---|---|
refresh | str = "" | One of the REFRESH_ values. |
routing | str = "" | The routing value, to place a document on a chosen shard. |
pipeline | str = "" | An ingest pipeline to run the document through. |
timeout | str = "" | How long to wait for shards, such as 5s. |
wait_for_active_shards | str = "" | How many shard copies must be active, or all. |
conflicts | str = "" | For by query calls: proceed keeps going past version conflicts. |
if_seq_no | i64 = -1 | Write only if the document still has this sequence number. |
if_primary_term | i64 = -1 | Write only if the document still has this primary term. |
retry_on_conflict | int = -1 | For updates: how many times to retry on a version conflict. |
version | i64 = -1 | An explicit document version. |
version_type | str = "" | The version type, such as external. |
require_alias | bool = false | The target must be an alias. |
The example for this item is shown with the ones above: db-opensearch-Index.salam
WriteResult
struct WriteResult| Name | Type | Description |
|---|---|---|
ok | bool = false | The write succeeded. |
status | int = 0 | The HTTP status. |
index | str = "" | The index written to. |
id | str = "" | The document id; generated when you passed none. |
result | str = "" | created, updated, deleted, noop or not_found. |
version | i64 = 0 | The new document version. |
seq_no | i64 = -1 | The new sequence number. |
primary_term | i64 = 0 | The primary term. |
shards_total | int = 0 | How many shard copies should hold the write. |
shards_successful | int = 0 | How many did. |
error | str = "" | What went wrong. |
The example for this item is shown with the ones above: db-opensearch-Index.salam
Document
struct Document| Name | Type | Description |
|---|---|---|
found | bool = false | The document exists. |
index | str = "" | Its index. |
id | str = "" | Its id. |
version | i64 = 0 | Its version. |
seq_no | i64 = -1 | Its sequence number, for a later conditional write. |
primary_term | i64 = 0 | Its primary term, for a later conditional write. |
routing | str = "" | Its routing value, if it has one. |
source | str = "" | The document as raw JSON. |
fields | str = "" | Stored fields as raw JSON, when asked for. |
error | str = "" | What went wrong; empty when the document simply does not exist. |
The example for this item is shown with the ones above: db-opensearch-Index.salam
Hit
struct Hit| Name | Type | Description |
|---|---|---|
index | str = "" | The index it came from. |
id | str = "" | The document id. |
score | f64 = 0 | Its relevance score. |
source | str = "" | The document as raw JSON. |
sort | str = "" | Its sort values as raw JSON; pass the last hit's to search_after for the next page. |
highlight | str = "" | The highlighted fragments as raw JSON. |
fields | str = "" | The requested fields as raw JSON. |
inner_hits | str = "" | Inner hits of a nested or collapsed query, as raw JSON. |
matched_queries | str = "" | Which named queries matched, as raw JSON. |
raw | str = "" | The whole hit as raw JSON. |
The example for this item is shown with the ones above: db-opensearch-Search.salam
SearchResult
struct SearchResult| Name | Type | Description |
|---|---|---|
ok | bool = false | The search succeeded. |
status | int = 0 | The HTTP status. |
took | i64 = 0 | How long it took on the server, in milliseconds. |
timed_out | bool = false | The server stopped early because of a timeout. |
total | i64 = 0 | How many documents matched. |
total_relation | str = "" | eq when total is exact, gte when it is a lower bound. |
max_score | f64 = 0 | The best score. |
hits | Vector | The hits of this page. |
aggregations | str = "" | The aggregations as raw JSON; read them with Buckets and AggValue. |
suggest | str = "" | The suggestions as raw JSON; read them with Suggestions. |
scroll_id | str = "" | The id for the next Scroll call. |
pit_id | str = "" | The point in time id the server sent back. |
raw | str = "" | The whole response. |
error | str = "" | What went wrong. |
The example for this item is shown with the ones above: db-opensearch-Search.salam
SearchRequest
struct SearchRequest| Name | Type | Description |
|---|---|---|
query | str = "" | The query, made with the builders or written as JSON. |
from | int = -1 | How many hits to skip. |
size | int = -1 | How many hits to return. |
sort | Vector | Sort clauses, such as SortDesc("date"). |
source | Vector | Return only these source fields. |
source_excludes | Vector | Leave these source fields out. |
no_source | bool = false | Return no source at all. |
fields | Vector | Fields to return in Hit.fields. |
docvalue_fields | Vector | Doc value fields to return. |
aggs | str = "" | The aggregations, built with AddAgg. |
highlight | str = "" | The highlight settings, from Highlight. |
post_filter | str = "" | A filter applied after the aggregations are counted. |
collapse | str = "" | Collapse hits on a field, from Collapse. |
suggest | str = "" | Suggesters, from TermSuggest or CompletionSuggest. |
rescore | str = "" | A rescore clause as JSON. |
script_fields | str = "" | Script fields as JSON. |
search_after | str = "" | The sort values of the last hit, as a JSON array, to fetch the next page. |
pit_id | str = "" | A point in time id from CreatePit; the search then goes to /_search and the index is not named. |
pit_keep_alive | str = "" | How much longer to keep the point in time, such as 1m. |
track_total_hits | str = "" | true, false or a number: how far to count matches exactly. |
track_scores | bool = false | Compute scores even when sorting by a field. |
min_score | str = "" | Leave out hits below this score. |
timeout | str = "" | Stop searching after this long, such as 2s. |
explain | bool = false | Explain how each score was computed. |
version | bool = false | Return each hit's version. |
seq_no_primary_term | bool = false | Return each hit's sequence number and primary term. |
ext | str = "" | Plugin extensions as JSON, such as retrieval augmented generation settings. |
extra | Vector | More members written as "key":value, added as they are. |
The example for this item is shown with the ones above: db-opensearch-Query.salam
Bucket
struct Bucket| Name | Type | Description |
|---|---|---|
key | str = "" | Its key as text. |
key_as_string | str = "" | The formatted key, for dates and numbers with a format. |
doc_count | i64 = 0 | How many documents fell in it. |
raw | str = "" | The bucket as raw JSON, with any sub aggregations. |
The example for this item is shown with the ones above: db-opensearch-Search.salam
Bulk
struct Bulk| Name | Type | Description |
|---|---|---|
lines | Vector | The NDJSON lines so far. |
count | int = 0 | How many actions it holds. |
The example for this item is shown with the ones above: db-opensearch-Index.salam
BulkItem
struct BulkItem| Name | Type | Description |
|---|---|---|
action | str = "" | index, create, update or delete. |
index | str = "" | The index. |
id | str = "" | The document id. |
status | int = 0 | The HTTP status of this action. |
ok | bool = false | It succeeded; deleting a document that is not there counts as success, as it does for OpenSearch. |
result | str = "" | The result, such as created. |
version | i64 = 0 | The new document version. |
error_type | str = "" | The error type when it failed. |
error_reason | str = "" | The error reason when it failed. |
The example for this item is shown with the ones above: db-opensearch-Index.salam
BulkResult
struct BulkResult| Name | Type | Description |
|---|---|---|
ok | bool = false | Every action succeeded. |
status | int = 0 | The HTTP status of the request. |
took | i64 = 0 | How long it took, in milliseconds. |
errors | bool = false | The server reported at least one failed action. |
succeeded | int = 0 | How many actions succeeded. |
failed | int = 0 | How many failed. |
items | Vector | One result per action, in order. |
error | str = "" | A summary of what went wrong. |
The example for this item is shown with the ones above: db-opensearch-Index.salam
Info
struct Info| Name | Type | Description |
|---|---|---|
ok | bool = false | The request succeeded. |
name | str = "" | The node name. |
cluster_name | str = "" | The cluster name. |
cluster_uuid | str = "" | The cluster id. |
version | str = "" | The OpenSearch version, such as 2.17.1. |
distribution | str = "" | opensearch. |
build_type | str = "" | How it was packaged, such as tar or rpm. |
lucene_version | str = "" | The Lucene version. |
minimum_wire_compatibility_version | str = "" | The oldest version it can talk to. |
tagline | str = "" | The tagline. |
The example for this item is shown with the ones above: db-opensearch-Client.salam
Health
struct Health| Name | Type | Description |
|---|---|---|
ok | bool = false | The request succeeded. |
cluster_name | str = "" | The cluster name. |
status | str = "" | green, yellow or red. |
timed_out | bool = false | A wait for status ran out of time. |
nodes | int = 0 | The number of nodes. |
data_nodes | int = 0 | The number of data nodes. |
active_primary_shards | int = 0 | Active primary shards. |
active_shards | int = 0 | All active shards. |
relocating_shards | int = 0 | Shards moving between nodes. |
initializing_shards | int = 0 | Shards starting up. |
unassigned_shards | int = 0 | Shards with no node. |
pending_tasks | int = 0 | Cluster tasks waiting. |
active_shards_percent | f64 = 0 | The share of active shards, from 0 to 100. |
The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
IndexInfo
struct IndexInfoCatIndices.| Name | Type | Description |
|---|---|---|
health | str = "" | green, yellow or red. |
status | str = "" | open or close. |
index | str = "" | The index name. |
uuid | str = "" | The index id. |
primaries | int = 0 | The number of primary shards. |
replicas | int = 0 | The number of replicas. |
docs_count | i64 = 0 | The number of documents. |
docs_deleted | i64 = 0 | Deleted documents not merged away yet. |
store_size | str = "" | The size on disk, in bytes. |
import db.opensearch
func main:
c := opensearch.Connect("http://localhost:9200")
mut props := Vector {} as Vector<str>
props.push(opensearch.Property("title", "text"))
props.push(opensearch.PropertyWith("title_fa", "text", `{"analyzer":"persian"}`))
props.push(opensearch.Property("tag", "keyword"))
props.push(opensearch.Property("year", "integer"))
println opensearch.CreateIndexWith(c, "books", 1, 0, opensearch.Properties(props))
println opensearch.CreateIndex(c, "logs-000001", `{"aliases":{"logs":{"is_write_index":true}}}`)
println opensearch.IndexExists(c, "books"), opensearch.GetIndex(c, "books").len() > 0
println opensearch.PutMapping(c, "books", "{" + opensearch.Property("isbn", "keyword") + "}")
println opensearch.PutMappingBody(c, "books", `{"dynamic":"strict"}`), opensearch.GetMapping(c, "books")
println opensearch.PutSettings(c, "books", `{"index":{"refresh_interval":"5s"}}`)
println opensearch.GetSettings(c, "books").len() > 0, opensearch.GetSetting(c, "books", "index.refresh_interval")
println opensearch.Refresh(c, "books"), opensearch.Flush(c, "books"), opensearch.ForceMerge(c, "books", 1), opensearch.ClearCache(c, "books")
println opensearch.CloseIndex(c, "books"), opensearch.OpenIndex(c, "books")
println opensearch.PutSettings(c, "books", `{"index.blocks.write":true}`)
println opensearch.CloneIndex(c, "books", "books_clone", ""), opensearch.ShrinkIndex(c, "books", "books_small", ""), opensearch.SplitIndex(c, "books", "books_big", `{"settings":{"index.number_of_shards":2}}`)
println opensearch.IndexStats(c, "books").len() > 0
println opensearch.PutAlias(c, "books", "library"), opensearch.AliasExists(c, "library"), opensearch.AliasIndices(c, "library")
println opensearch.PutAliasFiltered(c, "books", "poetry", opensearch.Term("tag", "poetry"), false)
println opensearch.GetAliases(c, "books"), opensearch.DeleteAlias(c, "books", "poetry")
mut acts := Vector {} as Vector<str>
acts.push(opensearch.AliasAction("add", "books_clone", "library"))
acts.push(opensearch.AliasAction("remove", "books", "library"))
println opensearch.UpdateAliases(c, acts), opensearch.SwapAlias(c, "library", "books_clone", "books")
mut patterns := Vector {} as Vector<str>
patterns.push("logs-*")
tpl := opensearch.IndexTemplate(patterns, `{"number_of_replicas":0}`, "{" + opensearch.Property("msg", "text") + "}", 10)
println opensearch.PutIndexTemplate(c, "logs", tpl), opensearch.IndexTemplateExists(c, "logs"), opensearch.GetIndexTemplate(c, "logs").len() > 0
println opensearch.PutComponentTemplate(c, "base", `{"template":{"settings":{"number_of_shards":1}}}`), opensearch.GetComponentTemplate(c, "base").len() > 0
println opensearch.Rollover(c, "logs", `{"max_docs":1000000,"max_age":"7d"}`)
println opensearch.PutIndexTemplate(c, "events", `{"index_patterns":["events-*"],"data_stream":{}}`)
println opensearch.CreateDataStream(c, "events-web"), opensearch.DataStreams(c), opensearch.DeleteDataStream(c, "events-web")
println opensearch.Analyze(c, "", "standard", "Salam to OpenSearch")
each ix in opensearch.CatIndices(c, "books*"):
println ix.health, ix.status, ix.index, ix.uuid, ix.primaries, ix.replicas, ix.docs_count, ix.docs_deleted, ix.store_size
end
println opensearch.DeleteIndexTemplate(c, "logs"), opensearch.DeleteIndexTemplate(c, "events"), opensearch.DeleteComponentTemplate(c, "base")
println opensearch.DeleteIndex(c, "books_clone,books_small,books_big"), opensearch.DeleteIndexIfExists(c, "never-made")
endSqlRows
struct SqlRowsdb.Rows.| Name | Type | Description |
|---|---|---|
handle | void* | The internal state. |
import db
import db.opensearch
func main:
c := opensearch.Connect("http://localhost:9200")
conn := opensearch.Conn(c)
println conn.Kind(), conn.Ok(), conn.Ping(), db.QueryInt(conn, "SELECT COUNT(*) FROM books")
rows := conn.Query("SELECT title, year, price FROM books WHERE year > 1000 ORDER BY year")
println rows.Ok(), rows.ColumnCount(), rows.ColumnName(0), rows.ColumnType(1)
until rows.Next():
println rows.Text(0), rows.Int(1), rows.Int64(1), rows.Float(2), rows.IsNull(2)
end
rows.Close()
println conn.Exec("DELETE FROM books WHERE year < 0"), conn.Changes(), conn.LastInsertId(), conn.Error(), conn.Quote("it's")
tx := conn.Begin()
println tx.Ok(), tx.Exec("SELECT 1"), tx.Query("SELECT 1").Ok(), tx.Commit(), tx.Rollback()
mut params := Vector {} as Vector<str>
params.push(opensearch.SqlParam("integer", "1000"))
mut paged := opensearch.SqlWith(c, "SELECT title FROM books WHERE year > ?", params, 100)
println paged.Total(), paged.ColumnTypeName(0), paged.Error()
until paged.Next():
println paged.Raw(0)
end
paged.Close()
rs := opensearch.Sql(c, "SHOW TABLES LIKE books%")
rs.Close()
println opensearch.SqlFormat(c, "SELECT title FROM books", "csv")
println opensearch.SqlExplain(c, "SELECT title FROM books").len() > 0
p := opensearch.Ppl(c, "source=books | where year > 1000 | stats count() by tag")
until p.Next():
println p.Int(0), p.Text(1)
end
p.Close()
println opensearch.PplFormat(c, "source=books | fields title", "raw"), opensearch.PplExplain(c, "source=books").len() > 0
d := opensearch.Database { handle = c.handle }
t := opensearch.Txn {}
println d.Kind(), t.Ok(), conn.Close()
endOk
func Ok(): boolThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Error
func Error(): strThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Total
func Total(): i64The example for this item is shown with the ones above: db-opensearch-Sql.salam
Next
func Next(): boolThe example for this item is shown with the ones above: db-opensearch-Sql.salam
ColumnCount
func ColumnCount(): intThe example for this item is shown with the ones above: db-opensearch-Sql.salam
ColumnName
func ColumnName(col: int): strThe example for this item is shown with the ones above: db-opensearch-Sql.salam
ColumnTypeName
func ColumnTypeName(col: int): strkeyword or long.The example for this item is shown with the ones above: db-opensearch-Sql.salam
ColumnType
func ColumnType(col: int): intTYPE_ constants of db.The example for this item is shown with the ones above: db-opensearch-Sql.salam
IsNull
func IsNull(col: int): boolThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Text
func Text(col: int): strThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Raw
func Raw(col: int): strThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Int
func Int(col: int): intThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Int64
func Int64(col: int): i64The example for this item is shown with the ones above: db-opensearch-Sql.salam
Float
func Float(col: int): f64The example for this item is shown with the ones above: db-opensearch-Sql.salam
Close
func Close(): intThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Database
struct Databasedb.Connection, from Conn.| Name | Type | Description |
|---|---|---|
handle | void* | The client state. |
The example for this item is shown with the ones above: db-opensearch-Sql.salam
Kind
func Kind(): strdb.OPENSEARCH.The example for this item is shown with the ones above: db-opensearch-Sql.salam
Ok
func Ok(): boolThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Ping
func Ping(): boolThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Exec
func Exec(sql: str): intDELETE and returns how many documents it deleted, if the cluster allows SQL deletes; anything else is -1, since OpenSearch SQL is otherwise read only.The example for this item is shown with the ones above: db-opensearch-Sql.salam
Query
func Query(sql: str): dyn db.RowsThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Begin
func Begin(): dyn db.TxThe example for this item is shown with the ones above: db-opensearch-Sql.salam
LastInsertId
func LastInsertId(): i64Index.The example for this item is shown with the ones above: db-opensearch-Sql.salam
Changes
func Changes(): i64Exec deleted.The example for this item is shown with the ones above: db-opensearch-Sql.salam
Error
func Error(): strThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Quote
func Quote(s: str): strThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Close
func Close(): intThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Txn
struct TxnBegin returns; every call fails.| Name | Type | Description |
|---|---|---|
handle | void* | Unused. |
The example for this item is shown with the ones above: db-opensearch-Sql.salam
Ok
func Ok(): boolThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Exec
func Exec(_sql: str): intThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Query
func Query(_sql: str): dyn db.RowsThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Commit
func Commit(): intThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Rollback
func Rollback(): intThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Constants and variables
VERSION
const VERSION: str = "1.0.0"The example for this item is shown with the ones above: db-opensearch-Client.salam
DEFAULT_URL
const DEFAULT_URL: str = "http://localhost:9200"http://localhost:9200.The example for this item is shown with the ones above: db-opensearch-Client.salam
DEFAULT_PORT
const DEFAULT_PORT: i32 = 9200The example for this item is shown with the ones above: db-opensearch-Client.salam
DEAD_NODE_MS
const DEAD_NODE_MS: i32 = 60000The example for this item is shown with the ones above: db-opensearch-Client.salam
REFRESH_TRUE
const REFRESH_TRUE: str = "true"The example for this item is shown with the ones above: db-opensearch-Index.salam
REFRESH_WAIT_FOR
const REFRESH_WAIT_FOR: str = "wait_for"The example for this item is shown with the ones above: db-opensearch-Index.salam
REFRESH_FALSE
const REFRESH_FALSE: str = "false"The example for this item is shown with the ones above: db-opensearch-Index.salam
SERVICE_ES
const SERVICE_ES: str = "es"The example for this item is shown with the ones above: db-opensearch-Client.salam
SERVICE_AOSS
const SERVICE_AOSS: str = "aoss"The example for this item is shown with the ones above: db-opensearch-Client.salam
Functions
NewBulk
func NewBulk(): BulkThe example for this item is shown with the ones above: db-opensearch-Index.salam
BulkIndex
func BulkIndex(b &: Bulk, index: str, id: str, doc: str)The example for this item is shown with the ones above: db-opensearch-Index.salam
BulkIndexRouted
func BulkIndexRouted(b &: Bulk, index: str, id: str, routing: str, doc: str)The example for this item is shown with the ones above: db-opensearch-Index.salam
BulkCreate
func BulkCreate(b &: Bulk, index: str, id: str, doc: str)The example for this item is shown with the ones above: db-opensearch-Index.salam
BulkUpdate
func BulkUpdate(b &: Bulk, index: str, id: str, partial: str)The example for this item is shown with the ones above: db-opensearch-Index.salam
BulkUpsert
func BulkUpsert(b &: Bulk, index: str, id: str, doc: str)The example for this item is shown with the ones above: db-opensearch-Index.salam
BulkDelete
func BulkDelete(b &: Bulk, index: str, id: str)The example for this item is shown with the ones above: db-opensearch-Index.salam
BulkLen
func BulkLen(b: Bulk): intThe example for this item is shown with the ones above: db-opensearch-Index.salam
BulkBody
func BulkBody(b: Bulk): strThe example for this item is shown with the ones above: db-opensearch-Index.salam
BulkReset
func BulkReset(b &: Bulk)The example for this item is shown with the ones above: db-opensearch-Index.salam
BulkFree
func BulkFree(b &: Bulk)The example for this item is shown with the ones above: db-opensearch-Index.salam
ParseBulk
func ParseBulk(body: str): BulkResultThe example for this item is shown with the ones above: db-opensearch-Index.salam
BulkSend
func BulkSend(c: Client, b: Bulk): BulkResultThe example for this item is shown with the ones above: db-opensearch-Index.salam
BulkSendWith
func BulkSendWith(c: Client, b: Bulk, refresh: str): BulkResultThe example for this item is shown with the ones above: db-opensearch-Index.salam
MatchAll
func MatchAll(): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
MatchNone
func MatchNone(): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Match
func Match(field: str, text: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
MatchAnd
func MatchAnd(field: str, text: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
MatchFuzzy
func MatchFuzzy(field: str, text: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
MatchPhrase
func MatchPhrase(field: str, text: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
MatchPhraseSlop
func MatchPhraseSlop(field: str, text: str, slop: int): strslop words between.The example for this item is shown with the ones above: db-opensearch-Query.salam
MatchPhrasePrefix
func MatchPhrasePrefix(field: str, text: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
MatchBoolPrefix
func MatchBoolPrefix(field: str, text: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
MultiMatch
func MultiMatch(text: str, fields: Vector<str>): strtitle^2 weighs a field.The example for this item is shown with the ones above: db-opensearch-Query.salam
MultiMatchType
func MultiMatchType(text: str, fields: Vector<str>, kind: str): strMultiMatch of a type such as best_fields, most_fields, phrase or cross_fields.The example for this item is shown with the ones above: db-opensearch-Query.salam
Term
func Term(field: str, value: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
TermInt
func TermInt(field: str, value: i64): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
TermBool
func TermBool(field: str, value: bool): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
TermCaseInsensitive
func TermCaseInsensitive(field: str, value: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Terms
func Terms(field: str, values: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
TermsInt
func TermsInt(field: str, values: Vector<i64>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
TermsLookup
func TermsLookup(field: str, index: str, id: str, path: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
TermsSet
func TermsSet(field: str, values: Vector<str>, minimum_field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Range
func Range(field: str, low: str, high: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
RangeExclusive
func RangeExclusive(field: str, low: str, high: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
RangeNum
func RangeNum(field: str, low: f64, high: f64): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
RangeInt
func RangeInt(field: str, low: i64, high: i64): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
RangeOp
func RangeOp(field: str, op: str, value: str): strgt, gte, lt or lte.The example for this item is shown with the ones above: db-opensearch-Query.salam
DateRange
func DateRange(field: str, low: str, high: str, format: str, time_zone: str): strnow-7d/d works.The example for this item is shown with the ones above: db-opensearch-Query.salam
FieldExists
func FieldExists(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Prefix
func Prefix(field: str, value: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Wildcard
func Wildcard(field: str, pattern: str): str* and ?.The example for this item is shown with the ones above: db-opensearch-Query.salam
Regexp
func Regexp(field: str, pattern: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Fuzzy
func Fuzzy(field: str, value: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Ids
func Ids(ids: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
QueryString
func QueryString(query: str): strtitle:salam AND year:1403.The example for this item is shown with the ones above: db-opensearch-Query.salam
QueryStringFields
func QueryStringFields(query: str, fields: Vector<str>, default_operator: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
SimpleQueryString
func SimpleQueryString(query: str, fields: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
BoolOf
func BoolOf(q: BoolQuery): strBoolQuery.The example for this item is shown with the ones above: db-opensearch-Query.salam
Bool
func Bool(must: Vector<str>, filter: Vector<str>, should: Vector<str>, must_not: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
And
func And(clauses: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Or
func Or(clauses: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Not
func Not(clause: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Filtered
func Filtered(query: str, filters: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
ConstantScore
func ConstantScore(filter: str, boost: f64): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
DisMax
func DisMax(queries: Vector<str>, tie_breaker: f64): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Boosting
func Boosting(positive: str, negative: str, negative_boost: f64): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Nested
func Nested(path: str, query: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
HasChild
func HasChild(child_type: str, query: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
HasParent
func HasParent(parent_type: str, query: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
MoreLikeThis
func MoreLikeThis(fields: Vector<str>, like: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
ScriptQuery
func ScriptQuery(source: str, params: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Script
func Script(source: str, params: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
ScriptScore
func ScriptScore(query: str, source: str, params: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
FunctionScore
func FunctionScore(query: str, functions: Vector<str>, score_mode: str, boost_mode: str): strFieldValueFactor.The example for this item is shown with the ones above: db-opensearch-Query.salam
FieldValueFactor
func FieldValueFactor(field: str, factor: f64, modifier: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
GeoDistance
func GeoDistance(field: str, lat: f64, lon: f64, distance: str): str5km, of a place.The example for this item is shown with the ones above: db-opensearch-Query.salam
GeoBoundingBox
func GeoBoundingBox(field: str, top: f64, left: f64, bottom: f64, right: f64): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Knn
func Knn(field: str, vector: Vector<f64>, k: int): strknn_vector field.The example for this item is shown with the ones above: db-opensearch-Query.salam
KnnFiltered
func KnnFiltered(field: str, vector: Vector<f64>, k: int, filter: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
KnnRadial
func KnnRadial(field: str, vector: Vector<f64>, max_distance: f64): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
KnnMinScore
func KnnMinScore(field: str, vector: Vector<f64>, min_score: f64): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Neural
func Neural(field: str, query_text: str, model_id: str, k: int): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
NeuralSparse
func NeuralSparse(field: str, query_text: str, model_id: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Hybrid
func Hybrid(queries: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
SortAsc
func SortAsc(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
SortDesc
func SortDesc(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
SortScore
func SortScore(): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
SortGeo
func SortGeo(field: str, lat: f64, lon: f64, unit: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Highlight
func Highlight(fields: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
HighlightTags
func HighlightTags(fields: Vector<str>, pre: str, post: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Collapse
func Collapse(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
TermSuggest
func TermSuggest(name: str, text: str, field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
CompletionSuggest
func CompletionSuggest(name: str, prefix: str, field: str, size: int): strcompletion field.The example for this item is shown with the ones above: db-opensearch-Query.salam
TermsAgg
func TermsAgg(field: str, size: int): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
AvgAgg
func AvgAgg(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
SumAgg
func SumAgg(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
MinAgg
func MinAgg(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
MaxAgg
func MaxAgg(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
ValueCountAgg
func ValueCountAgg(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
CardinalityAgg
func CardinalityAgg(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
StatsAgg
func StatsAgg(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
ExtendedStatsAgg
func ExtendedStatsAgg(field: str): strStatsAgg plus variance and standard deviation.The example for this item is shown with the ones above: db-opensearch-Query.salam
PercentilesAgg
func PercentilesAgg(field: str, percents: Vector<f64>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
HistogramAgg
func HistogramAgg(field: str, interval: f64): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
DateHistogramAgg
func DateHistogramAgg(field: str, calendar_interval: str): strday or month.The example for this item is shown with the ones above: db-opensearch-Query.salam
RangeAgg
func RangeAgg(field: str, bounds: Vector<f64>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
FilterAgg
func FilterAgg(query: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
NestedAgg
func NestedAgg(path: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
MissingAgg
func MissingAgg(field: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
TopHitsAgg
func TopHitsAgg(size: int): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
CompositeAgg
func CompositeAgg(fields: Vector<str>, size: int): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
AddAgg
func AddAgg(aggs: str, name: str, agg: str): str{}.The example for this item is shown with the ones above: db-opensearch-Query.salam
SubAggs
func SubAggs(agg: str, aggs: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
AddMember
func AddMember(obj: str, key: str, raw: str): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
SearchBody
func SearchBody(req: SearchRequest): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
Search
func Search(c: Client, index: str, query: str): SearchResultThe example for this item is shown with the ones above: db-opensearch-Search.salam
SearchWith
func SearchWith(c: Client, index: str, req: SearchRequest): SearchResultThe example for this item is shown with the ones above: db-opensearch-Search.salam
SearchRaw
func SearchRaw(c: Client, index: str, body: str): SearchResultThe example for this item is shown with the ones above: db-opensearch-Search.salam
SearchParamsWith
func SearchParamsWith(c: Client, index: str, body: str, p: SearchParams): SearchResultThe example for this item is shown with the ones above: db-opensearch-Search.salam
ParseSearch
func ParseSearch(body: str): SearchResultThe example for this item is shown with the ones above: db-opensearch-Search.salam
SearchScroll
func SearchScroll(c: Client, index: str, req: SearchRequest, keep_alive: str): SearchResultThe example for this item is shown with the ones above: db-opensearch-Search.salam
Scroll
func Scroll(c: Client, scroll_id: str, keep_alive: str): SearchResultThe example for this item is shown with the ones above: db-opensearch-Search.salam
ClearScroll
func ClearScroll(c: Client, scroll_id: str): boolThe example for this item is shown with the ones above: db-opensearch-Search.salam
CreatePit
func CreatePit(c: Client, index: str, keep_alive: str): strsearch_after; returns its id.The example for this item is shown with the ones above: db-opensearch-Search.salam
DeletePit
func DeletePit(c: Client, pit_id: str): boolThe example for this item is shown with the ones above: db-opensearch-Search.salam
DeleteAllPits
func DeleteAllPits(c: Client): boolThe example for this item is shown with the ones above: db-opensearch-Search.salam
ListPits
func ListPits(c: Client): Vector<str>The example for this item is shown with the ones above: db-opensearch-Search.salam
MSearch
func MSearch(c: Client, index: str, bodies: Vector<str>): Vector<SearchResult>The example for this item is shown with the ones above: db-opensearch-Search.salam
SearchTemplate
func SearchTemplate(c: Client, index: str, template_id: str, params: str): SearchResultThe example for this item is shown with the ones above: db-opensearch-Search.salam
SearchInlineTemplate
func SearchInlineTemplate(c: Client, index: str, source: str, params: str): SearchResultThe example for this item is shown with the ones above: db-opensearch-Search.salam
RenderTemplate
func RenderTemplate(c: Client, source: str, params: str): strThe example for this item is shown with the ones above: db-opensearch-Search.salam
Explain
func Explain(c: Client, index: str, id: str, query: str): strThe example for this item is shown with the ones above: db-opensearch-Search.salam
Validate
func Validate(c: Client, index: str, query: str): boolThe example for this item is shown with the ones above: db-opensearch-Search.salam
FieldCaps
func FieldCaps(c: Client, index: str, fields: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-Search.salam
Buckets
func Buckets(aggregations: str, name: str): Vector<Bucket>The example for this item is shown with the ones above: db-opensearch-Search.salam
AggValue
func AggValue(aggregations: str, name: str): f64avg.The example for this item is shown with the ones above: db-opensearch-Search.salam
AggField
func AggField(aggregations: str, name: str, field: str): f64max of stats.The example for this item is shown with the ones above: db-opensearch-Search.salam
AggRaw
func AggRaw(aggregations: str, name: str): strThe example for this item is shown with the ones above: db-opensearch-Search.salam
Suggestions
func Suggestions(suggest: str, name: str): Vector<str>The example for this item is shown with the ones above: db-opensearch-Search.salam
JsonPath
func JsonPath(text: str, path: str): strhits.hits.0._id; strings come back unquoted.The example for this item is shown with the ones above: db-opensearch-Search.salam
JsonPathRaw
func JsonPathRaw(text: str, path: str): strThe example for this item is shown with the ones above: db-opensearch-Search.salam
JsonItems
func JsonItems(raw: str): Vector<str>The example for this item is shown with the ones above: db-opensearch-Search.salam
GetInfo
func GetInfo(c: Client): InfoThe example for this item is shown with the ones above: db-opensearch-Client.salam
Ping
func Ping(c: Client): boolThe example for this item is shown with the ones above: db-opensearch-Client.salam
ClusterHealth
func ClusterHealth(c: Client): HealthThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
WaitForStatus
func WaitForStatus(c: Client, index: str, status: str, timeout: str): Healthyellow, or until the timeout.The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
ClusterStats
func ClusterStats(c: Client): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
ClusterState
func ClusterState(c: Client, metrics: str): strmetadata.The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
GetClusterSettings
func GetClusterSettings(c: Client): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
PutClusterSettings
func PutClusterSettings(c: Client, persistent: str, transient: str): boolThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
AllocationExplain
func AllocationExplain(c: Client, body: str): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
NodesInfo
func NodesInfo(c: Client, metrics: str): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
NodesStats
func NodesStats(c: Client, metrics: str): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
HotThreads
func HotThreads(c: Client): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
Cat
func Cat(c: Client, what: str): Vector<str>shards or nodes, as one JSON object per row.The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
CatText
func CatText(c: Client, what: str): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
Plugins
func Plugins(c: Client): Vector<str>The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
HasPlugin
func HasPlugin(c: Client, name: str): boolopensearch-knn, is installed.The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
GetTask
func GetTask(c: Client, task_id: str): TaskInfoThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
WaitTask
func WaitTask(c: Client, task_id: str, timeout: str): TaskInfoThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
CancelTask
func CancelTask(c: Client, task_id: str): boolThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
ListTasks
func ListTasks(c: Client, actions: str): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
PutRepository
func PutRepository(c: Client, name: str, kind: str, settings: str): boolfs or s3.The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
GetRepository
func GetRepository(c: Client, name: str): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
VerifyRepository
func VerifyRepository(c: Client, name: str): boolThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
DeleteRepository
func DeleteRepository(c: Client, name: str): boolThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
CreateSnapshot
func CreateSnapshot(c: Client, repo: str, snapshot: str, indices: str, wait: bool): boolwait true it is true only when the snapshot succeeded.The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
GetSnapshot
func GetSnapshot(c: Client, repo: str, snapshot: str): str_all works too.The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
Snapshots
func Snapshots(c: Client, repo: str): Vector<str>The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
SnapshotStatus
func SnapshotStatus(c: Client, repo: str, snapshot: str): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
DeleteSnapshot
func DeleteSnapshot(c: Client, repo: str, snapshot: str): boolThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
RestoreSnapshot
func RestoreSnapshot(c: Client, repo: str, snapshot: str, body: str, wait: bool): boolThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
PutPipeline
func PutPipeline(c: Client, id: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
Pipeline
func Pipeline(description: str, processors: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
Processor
func Processor(kind: str, config: str): strProcessor("lowercase", `{"field":"tag"}`).The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
GetPipeline
func GetPipeline(c: Client, id: str): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
DeletePipeline
func DeletePipeline(c: Client, id: str): boolThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
SimulatePipeline
func SimulatePipeline(c: Client, id: str, docs: Vector<str>): Vector<str>The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
PutScript
func PutScript(c: Client, id: str, source: str): boolThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
PutSearchTemplate
func PutSearchTemplate(c: Client, id: str, source: str): boolSearchTemplate.The example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
GetScript
func GetScript(c: Client, id: str): strThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
DeleteScript
func DeleteScript(c: Client, id: str): boolThe example for this item is shown with the ones above: db-opensearch-ClusterHealth.salam
KnnIndexSettings
func KnnIndexSettings(shards: int, replicas: int): strThe example for this item is shown with the ones above: db-opensearch-Knn.salam
KnnVectorField
func KnnVectorField(dimension: int, method: KnnMethod): strknn_vector field.The example for this item is shown with the ones above: db-opensearch-Knn.salam
KnnIndexBody
func KnnIndexBody(field: str, dimension: int, method: KnnMethod, extra_properties: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-Knn.salam
KnnVector
func KnnVector(values: Vector<f64>): strThe example for this item is shown with the ones above: db-opensearch-Query.salam
KnnStats
func KnnStats(c: Client): strThe example for this item is shown with the ones above: db-opensearch-Knn.salam
KnnWarmup
func KnnWarmup(c: Client, index: str): boolThe example for this item is shown with the ones above: db-opensearch-Knn.salam
KnnClearCache
func KnnClearCache(c: Client, index: str): boolThe example for this item is shown with the ones above: db-opensearch-Knn.salam
KnnTrainModel
func KnnTrainModel(c: Client, model_id: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-Knn.salam
KnnGetModel
func KnnGetModel(c: Client, model_id: str): strThe example for this item is shown with the ones above: db-opensearch-Knn.salam
KnnDeleteModel
func KnnDeleteModel(c: Client, model_id: str): boolThe example for this item is shown with the ones above: db-opensearch-Knn.salam
PutPolicy
func PutPolicy(c: Client, id: str, policy: str): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
UpdatePolicy
func UpdatePolicy(c: Client, id: str, policy: str, seq_no: i64, primary_term: i64): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
GetPolicy
func GetPolicy(c: Client, id: str): strThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
DeletePolicy
func DeletePolicy(c: Client, id: str): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
AddPolicy
func AddPolicy(c: Client, index: str, policy_id: str): intThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
RemovePolicy
func RemovePolicy(c: Client, index: str): intThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
ChangePolicy
func ChangePolicy(c: Client, index: str, policy_id: str, state: str): intThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
RetryPolicy
func RetryPolicy(c: Client, index: str): intThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
ExplainPolicy
func ExplainPolicy(c: Client, index: str): strThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
PolicyIdOf
func PolicyIdOf(c: Client, index: str): strThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
DeleteAfterPolicy
func DeleteAfterPolicy(description: str, min_index_age: str, patterns: Vector<str>): str30d; with patterns it applies to new matching indices by itself.The example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
WhoAmI
func WhoAmI(c: Client): AuthInfoThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
SecurityHealth
func SecurityHealth(c: Client): strUP.The example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
PutUser
func PutUser(c: Client, name: str, password: str, backend_roles: Vector<str>, attributes: str): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
GetUser
func GetUser(c: Client, name: str): strThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
Users
func Users(c: Client): Vector<str>The example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
DeleteUser
func DeleteUser(c: Client, name: str): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
ChangePassword
func ChangePassword(c: Client, current: str, password: str): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
RoleBody
func RoleBody(cluster_permissions: Vector<str>, index_patterns: Vector<str>, allowed_actions: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
PutRole
func PutRole(c: Client, name: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
GetRole
func GetRole(c: Client, name: str): strThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
DeleteRole
func DeleteRole(c: Client, name: str): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
PutRoleMapping
func PutRoleMapping(c: Client, role: str, users: Vector<str>, backend_roles: Vector<str>): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
GetRoleMapping
func GetRoleMapping(c: Client, role: str): strThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
DeleteRoleMapping
func DeleteRoleMapping(c: Client, role: str): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
PutSearchPipeline
func PutSearchPipeline(c: Client, id: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-Knn.salam
GetSearchPipeline
func GetSearchPipeline(c: Client, id: str): strThe example for this item is shown with the ones above: db-opensearch-Knn.salam
DeleteSearchPipeline
func DeleteSearchPipeline(c: Client, id: str): boolThe example for this item is shown with the ones above: db-opensearch-Knn.salam
NormalizationPipeline
func NormalizationPipeline(normalization: str, combination: str, weights: Vector<f64>): strmin_max, a combination such as arithmetic_mean and optional weights.The example for this item is shown with the ones above: db-opensearch-Knn.salam
CreateMonitor
func CreateMonitor(c: Client, body: str): strThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
GetMonitor
func GetMonitor(c: Client, id: str): strThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
UpdateMonitor
func UpdateMonitor(c: Client, id: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
DeleteMonitor
func DeleteMonitor(c: Client, id: str): boolThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
ExecuteMonitor
func ExecuteMonitor(c: Client, id: str, dry_run: bool): strThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
SearchMonitors
func SearchMonitors(c: Client, query: str): SearchResultThe example for this item is shown with the ones above: db-opensearch-PutPolicy.salam
MlRegisterModel
func MlRegisterModel(c: Client, body: str): strThe example for this item is shown with the ones above: db-opensearch-Knn.salam
MlDeployModel
func MlDeployModel(c: Client, model_id: str): strThe example for this item is shown with the ones above: db-opensearch-Knn.salam
MlUndeployModel
func MlUndeployModel(c: Client, model_id: str): boolThe example for this item is shown with the ones above: db-opensearch-Knn.salam
MlGetModel
func MlGetModel(c: Client, model_id: str): strThe example for this item is shown with the ones above: db-opensearch-Knn.salam
MlDeleteModel
func MlDeleteModel(c: Client, model_id: str): boolThe example for this item is shown with the ones above: db-opensearch-Knn.salam
MlGetTask
func MlGetTask(c: Client, task_id: str): strThe example for this item is shown with the ones above: db-opensearch-Knn.salam
MlPredict
func MlPredict(c: Client, algorithm: str, model_id: str, body: str): strtext_embedding, on input as JSON.The example for this item is shown with the ones above: db-opensearch-Knn.salam
CreateIndex
func CreateIndex(c: Client, name: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
CreateIndexWith
func CreateIndexWith(c: Client, name: str, shards: int, replicas: int, properties: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
DeleteIndex
func DeleteIndex(c: Client, name: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
DeleteIndexIfExists
func DeleteIndexIfExists(c: Client, name: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
IndexExists
func IndexExists(c: Client, name: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
GetIndex
func GetIndex(c: Client, name: str): strThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
GetMapping
func GetMapping(c: Client, index: str): strThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
PutMapping
func PutMapping(c: Client, index: str, properties: str): boolproperties.The example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
PutMappingBody
func PutMappingBody(c: Client, index: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
GetSettings
func GetSettings(c: Client, index: str): strThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
GetSetting
func GetSetting(c: Client, index: str, name: str): strindex.refresh_interval.The example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
PutSettings
func PutSettings(c: Client, index: str, settings: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
Refresh
func Refresh(c: Client, index: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
Flush
func Flush(c: Client, index: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
ForceMerge
func ForceMerge(c: Client, index: str, max_segments: int): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
ClearCache
func ClearCache(c: Client, index: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
OpenIndex
func OpenIndex(c: Client, index: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
CloseIndex
func CloseIndex(c: Client, index: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
CloneIndex
func CloneIndex(c: Client, source: str, target: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
ShrinkIndex
func ShrinkIndex(c: Client, source: str, target: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
SplitIndex
func SplitIndex(c: Client, source: str, target: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
IndexStats
func IndexStats(c: Client, index: str): strThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
PutAlias
func PutAlias(c: Client, index: str, alias: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
PutAliasFiltered
func PutAliasFiltered(c: Client, index: str, alias: str, filter: str, is_write_index: bool): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
DeleteAlias
func DeleteAlias(c: Client, index: str, alias: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
AliasExists
func AliasExists(c: Client, alias: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
GetAliases
func GetAliases(c: Client, index: str): strThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
AliasIndices
func AliasIndices(c: Client, alias: str): Vector<str>The example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
AliasAction
func AliasAction(action: str, index: str, alias: str): stradd or remove action for UpdateAliases.The example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
UpdateAliases
func UpdateAliases(c: Client, actions: Vector<str>): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
SwapAlias
func SwapAlias(c: Client, alias: str, old_index: str, new_index: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
PutIndexTemplate
func PutIndexTemplate(c: Client, name: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
IndexTemplate
func IndexTemplate(patterns: Vector<str>, settings: str, properties: str, priority: int): strThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
GetIndexTemplate
func GetIndexTemplate(c: Client, name: str): strThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
IndexTemplateExists
func IndexTemplateExists(c: Client, name: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
DeleteIndexTemplate
func DeleteIndexTemplate(c: Client, name: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
PutComponentTemplate
func PutComponentTemplate(c: Client, name: str, body: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
GetComponentTemplate
func GetComponentTemplate(c: Client, name: str): strThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
DeleteComponentTemplate
func DeleteComponentTemplate(c: Client, name: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
CreateDataStream
func CreateDataStream(c: Client, name: str): booldata_stream must exist.The example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
DeleteDataStream
func DeleteDataStream(c: Client, name: str): boolThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
DataStreams
func DataStreams(c: Client): Vector<str>The example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
Rollover
func Rollover(c: Client, alias: str, conditions: str): strThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
Analyze
func Analyze(c: Client, index: str, analyzer: str, text: str): Vector<str>standard.The example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
CatIndices
func CatIndices(c: Client, pattern: str): Vector<IndexInfo>The example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
Property
func Property(name: str, kind: str): str"name":{"type":kind}, for Properties.The example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
PropertyWith
func PropertyWith(name: str, kind: str, extra: str): strThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
Properties
func Properties(props: Vector<str>): strThe example for this item is shown with the ones above: db-opensearch-CreateIndex.salam
Index
func Index(c: Client, index: str, id: str, doc: str): WriteResultThe example for this item is shown with the ones above: db-opensearch-Index.salam
IndexWith
func IndexWith(c: Client, index: str, id: str, doc: str, o: Options): WriteResultIndex with options.The example for this item is shown with the ones above: db-opensearch-Index.salam
Create
func Create(c: Client, index: str, id: str, doc: str): WriteResultThe example for this item is shown with the ones above: db-opensearch-Index.salam
CreateWith
func CreateWith(c: Client, index: str, id: str, doc: str, o: Options): WriteResultCreate with options.The example for this item is shown with the ones above: db-opensearch-Index.salam
Get
func Get(c: Client, index: str, id: str): DocumentThe example for this item is shown with the ones above: db-opensearch-Index.salam
GetFields
func GetFields(c: Client, index: str, id: str, includes: Vector<str>, routing: str): DocumentThe example for this item is shown with the ones above: db-opensearch-Index.salam
GetSource
func GetSource(c: Client, index: str, id: str): strThe example for this item is shown with the ones above: db-opensearch-Index.salam
Exists
func Exists(c: Client, index: str, id: str): boolThe example for this item is shown with the ones above: db-opensearch-Index.salam
Update
func Update(c: Client, index: str, id: str, partial: str): WriteResultThe example for this item is shown with the ones above: db-opensearch-Index.salam
UpdateWith
func UpdateWith(c: Client, index: str, id: str, body: str, o: Options): WriteResult{"doc":...} or {"script":...}, with options.The example for this item is shown with the ones above: db-opensearch-Index.salam
Upsert
func Upsert(c: Client, index: str, id: str, doc: str): WriteResultThe example for this item is shown with the ones above: db-opensearch-Index.salam
UpdateScript
func UpdateScript(c: Client, index: str, id: str, script: str, upsert: str): WriteResultScript; the upsert document, if given, is used when it is missing.The example for this item is shown with the ones above: db-opensearch-Index.salam
Delete
func Delete(c: Client, index: str, id: str): WriteResultThe example for this item is shown with the ones above: db-opensearch-Index.salam
DeleteWith
func DeleteWith(c: Client, index: str, id: str, o: Options): WriteResultDelete with options.The example for this item is shown with the ones above: db-opensearch-Index.salam
MGet
func MGet(c: Client, index: str, ids: Vector<str>): Vector<Document>The example for this item is shown with the ones above: db-opensearch-Index.salam
Count
func Count(c: Client, index: str, query: str): i64The example for this item is shown with the ones above: db-opensearch-Index.salam
DeleteByQuery
func DeleteByQuery(c: Client, index: str, query: str): ByQueryResultThe example for this item is shown with the ones above: db-opensearch-Index.salam
DeleteByQueryWith
func DeleteByQueryWith(c: Client, index: str, query: str, o: Options): ByQueryResultDeleteByQuery with options.The example for this item is shown with the ones above: db-opensearch-Index.salam
UpdateByQuery
func UpdateByQuery(c: Client, index: str, query: str, script: str): ByQueryResultThe example for this item is shown with the ones above: db-opensearch-Index.salam
UpdateByQueryWith
func UpdateByQueryWith(c: Client, index: str, query: str, script: str, o: Options): ByQueryResultUpdateByQuery with options.The example for this item is shown with the ones above: db-opensearch-Index.salam
Reindex
func Reindex(c: Client, source: str, dest: str): ByQueryResultThe example for this item is shown with the ones above: db-opensearch-Index.salam
ReindexBody
func ReindexBody(c: Client, body: str, wait: bool): ByQueryResultwait false it returns at once with a task id.The example for this item is shown with the ones above: db-opensearch-Index.salam
DefaultConfig
func DefaultConfig(): ConfigThe example for this item is shown with the ones above: db-opensearch-Client.salam
NewClient
func NewClient(cfg: Config): ClientOk.The example for this item is shown with the ones above: db-opensearch-Client.salam
Connect
func Connect(url: str): Clientuser:password@.The example for this item is shown with the ones above: db-opensearch-Client.salam
ConnectAuth
func ConnectAuth(url: str, username: str, password: str): ClientThe example for this item is shown with the ones above: db-opensearch-Client.salam
ConnectInsecure
func ConnectInsecure(url: str, username: str, password: str): ClientThe example for this item is shown with the ones above: db-opensearch-Client.salam
ConnectAWS
func ConnectAWS(url: str, region: str, service: str, access_key: str, secret_key: str, session_token: str): ClientThe example for this item is shown with the ones above: db-opensearch-Client.salam
Ok
func Ok(c: Client): boolThe example for this item is shown with the ones above: db-opensearch-Client.salam
Error
func Error(c: Client): strThe example for this item is shown with the ones above: db-opensearch-Client.salam
ErrorType
func ErrorType(c: Client): strThe example for this item is shown with the ones above: db-opensearch-Client.salam
ErrorReason
func ErrorReason(c: Client): strThe example for this item is shown with the ones above: db-opensearch-Client.salam
Status
func Status(c: Client): intThe example for this item is shown with the ones above: db-opensearch-Client.salam
Nodes
func Nodes(c: Client): Vector<str>The example for this item is shown with the ones above: db-opensearch-Client.salam
AuthHeader
func AuthHeader(c: Client): strThe example for this item is shown with the ones above: db-opensearch-Client.salam
SetSigningTime
func SetSigningTime(c: Client, epoch: i64)The example for this item is shown with the ones above: db-opensearch-Client.salam
Close
func Close(c &: Client)The example for this item is shown with the ones above: db-opensearch-Client.salam
Perform
func Perform(c: Client, method: str, path: str, body: str): ResponseThe example for this item is shown with the ones above: db-opensearch-Client.salam
PerformNdjson
func PerformNdjson(c: Client, method: str, path: str, body: str): ResponseThe example for this item is shown with the ones above: db-opensearch-Client.salam
PerformText
func PerformText(c: Client, method: str, path: str, body: str, content_type: str): ResponseThe example for this item is shown with the ones above: db-opensearch-Client.salam
EncodeBasic
func EncodeBasic(username: str, password: str): struser:password, as basic authentication sends it.The example for this item is shown with the ones above: db-opensearch-Client.salam
SqlParam
func SqlParam(kind: str, value: str): strSqlWith, such as SqlParam("integer", "5").The example for this item is shown with the ones above: db-opensearch-Sql.salam
Sql
func Sql(c: Client, query: str): SqlRowsThe example for this item is shown with the ones above: db-opensearch-Sql.salam
SqlWith
func SqlWith(c: Client, query: str, params: Vector<str>, fetch_size: int): SqlRows? parameters and a page size.The example for this item is shown with the ones above: db-opensearch-Sql.salam
SqlFormat
func SqlFormat(c: Client, query: str, format: str): strcsv, raw, json or jdbc.The example for this item is shown with the ones above: db-opensearch-Sql.salam
SqlExplain
func SqlExplain(c: Client, query: str): strThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Ppl
func Ppl(c: Client, query: str): SqlRowssource=logs | where code > 499 | stats count() by host.The example for this item is shown with the ones above: db-opensearch-Sql.salam
PplFormat
func PplFormat(c: Client, query: str, format: str): strThe example for this item is shown with the ones above: db-opensearch-Sql.salam
PplExplain
func PplExplain(c: Client, query: str): strThe example for this item is shown with the ones above: db-opensearch-Sql.salam
Conn
func Conn(c: Client): dyn db.Connectiondb.Connection, for code written against db.The example for this item is shown with the ones above: db-opensearch-Sql.salam
SignRequest
func SignRequest(method: str, host: str, path: str, body: str, region: str, service: str, access_key: str, secret_key: str, token: str, epoch: i64): strimport db.opensearch
func main:
headers := opensearch.SignRequest(
"GET", "example.amazonaws.com", "/", "", "us-east-1", "service", "AKIDEXAMPLE",
"wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY", "", 1440938160 as i64
)
each line in headers.split("\r\n"):
if line.len() > 0: println line end
end
end