Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
71 lines
1.6 KiB
Go
71 lines
1.6 KiB
Go
package mapping
|
|
|
|
import "github.com/cortezaproject/corteza/server/pkg/options"
|
|
|
|
type (
|
|
Mapping struct {
|
|
Index string `json:"index"`
|
|
Mapping map[string]*property `json:"mapping"`
|
|
}
|
|
|
|
property struct {
|
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html
|
|
Type string `json:"type,omitempty"`
|
|
|
|
// Boost factor
|
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html
|
|
Boost float32 `json:"boost,omitempty"`
|
|
|
|
Analyzer string `json:"analyzer,omitempty"`
|
|
|
|
Properties map[string]*property `json:"properties,omitempty"`
|
|
|
|
// for vector indexing
|
|
Dimension int `json:"dimension,omitempty"`
|
|
Method map[string]any `json:"method,omitempty"`
|
|
}
|
|
|
|
Context struct {
|
|
AccessRestriction string
|
|
}
|
|
)
|
|
|
|
func change() *property {
|
|
return &property{
|
|
Type: "nested",
|
|
Properties: map[string]*property{
|
|
"at": {Type: "date"},
|
|
"by": {Type: "nested", Properties: map[string]*property{
|
|
"id": {Type: "long"},
|
|
"email": {Type: "keyword"},
|
|
"name": {Type: "keyword"},
|
|
"handle": {Type: "keyword"},
|
|
}},
|
|
},
|
|
}
|
|
}
|
|
|
|
func security() *property {
|
|
return &property{
|
|
Properties: map[string]*property{
|
|
"allowedRoles": {Type: "long"},
|
|
"deniedRoles": {Type: "long"},
|
|
},
|
|
}
|
|
}
|
|
|
|
func vector(opts options.DiscoveryOpt) *property {
|
|
return &property{
|
|
Type: "knn_vector",
|
|
Dimension: opts.EmbeddingsDimension,
|
|
Method: map[string]any{
|
|
"name": "hnsw",
|
|
"engine": "lucene",
|
|
"parameters": map[string]any{
|
|
"ef_construction": opts.HnswEfConstruction,
|
|
"m": opts.HnswM,
|
|
},
|
|
},
|
|
}
|
|
}
|