fetcher/utils/reassign_topics/main.go

45 lines
907 B
Go

package main
import (
"flag"
"gitea.difrex.ru/Umbrella/fetcher/i2es"
)
var (
es, index, esType string
step, from, limit int
latest bool
)
func init() {
flag.StringVar(&es, "es", "http://127.0.0.1:9200", "Elasticsearch URL")
flag.StringVar(&index, "index", "idec", "Elasticsearch index")
flag.StringVar(&esType, "esType", "post", "Elasticsearch document type")
flag.IntVar(&step, "step", 100, "Scroll step")
flag.IntVar(&from, "from", 0, "Scroll from")
flag.IntVar(&limit, "limit", 2500, "Limit for latest posts")
flag.BoolVar(&latest, "latest", false, "Processing only latest posts")
flag.Parse()
}
func main() {
conf := Conf{
ES: i2es.ESConf{
Host: es,
Index: index,
Type: esType,
},
Step: step,
From: from,
Limit: limit,
}
con := newContainer()
if latest {
conf.assignLatests(&con)
} else {
conf.reassignTopic(&con)
}
conf.UpdateDocs(&con)
}