wip: mapping,setting import
This commit is contained in:
@ -82,6 +82,32 @@ type client struct {
|
||||
queryMap map[string]any
|
||||
}
|
||||
|
||||
func (c *client) ReadSetting() (map[string]any, error) {
|
||||
r, err := c.c.Indices.GetSettings(
|
||||
c.c.Indices.GetSettings.WithIndex(c.index),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if r.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("status=%d, msg=%s", r.StatusCode, r.String())
|
||||
}
|
||||
|
||||
m := make(map[string]any)
|
||||
decoder := json.NewDecoder(r.Body)
|
||||
if err = decoder.Decode(&m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *client) WriteSetting(m map[string]any) error {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (c *client) IsInput() bool {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
@ -95,7 +121,7 @@ func (c *client) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) Write(docs []*interfaces.ESSource) (int, error) {
|
||||
func (c *client) WriteData(docs []*interfaces.ESSource) (int, error) {
|
||||
var (
|
||||
err error
|
||||
indexer esutil.BulkIndexer
|
||||
@ -141,7 +167,7 @@ func (c *client) Write(docs []*interfaces.ESSource) (int, error) {
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (c *client) Read(i int) ([]*interfaces.ESSource, error) {
|
||||
func (c *client) ReadData(i int) ([]*interfaces.ESSource, error) {
|
||||
var (
|
||||
err error
|
||||
resp *esapi.Response
|
||||
@ -194,3 +220,28 @@ func (c *client) Read(i int) ([]*interfaces.ESSource, error) {
|
||||
|
||||
return result.Hits.Hits, nil
|
||||
}
|
||||
|
||||
func (c *client) ReadMapping() (map[string]any, error) {
|
||||
r, err := c.c.Indices.GetMapping(
|
||||
c.c.Indices.GetMapping.WithIndex(c.index),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if r.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("status=%d, msg=%s", r.StatusCode, r.String())
|
||||
}
|
||||
|
||||
m := make(map[string]any)
|
||||
decoder := json.NewDecoder(r.Body)
|
||||
if err = decoder.Decode(&m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return m, nil
|
||||
}
|
||||
func (c *client) WriteMapping(m map[string]any) error {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
Reference in New Issue
Block a user