https://github.com/xxjwxc/eslog
  
  
    elasticsearch log golang 的elasticsearch 日志封装,包括搜索,查询,添加等 
    https://github.com/xxjwxc/eslog
  
elasticsearch es go golang log
        Last synced: 7 months ago 
        JSON representation
    
elasticsearch log golang 的elasticsearch 日志封装,包括搜索,查询,添加等
- Host: GitHub
- URL: https://github.com/xxjwxc/eslog
- Owner: xxjwxc
- Created: 2019-05-25T12:40:29.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-19T09:34:17.000Z (about 2 years ago)
- Last Synced: 2025-03-25T20:06:29.381Z (7 months ago)
- Topics: elasticsearch, es, go, golang, log
- Language: Go
- Homepage:
- Size: 65.4 KB
- Stars: 20
- Watchers: 3
- Forks: 5
- Open Issues: 0
- 
            Metadata Files:
            - Readme: README.md
 
Awesome Lists containing this project
README
          # esLog
elasticsearch log golang 的elasticsearch 
Log encapsulation, including search, query, add, etc.
[中文版](README_zh-CN.md)
# elasticsearch Log Encapsulation Types
- install
```
 go get gopkg.in/olivere/elastic.v5
```
- init 
  
```go 
	e,err := New(WithIndexName("wms_log"), WithAddrs("http://192.168.198.17:9200/"))
```
- add
```go
	e,err := New(WithIndexName("wms_log"), WithAddrs("http://192.168.198.17:9200/"))
	var eslog es.ESLog
    ...
	b := e.Add(es.Index, es.Index, "", eslog)
	if !b {
		fmt.Println(e.Err)
	}
```
- search
```go
//Precise search
term := make(map[string]interface{})
...
//Fuzzy matching
match := make(map[string]interface{})
...
//Time Search
timeCase := make(map[string]es.CaseSection)
...
eslist := tools.Search(term, match, timeCase, req.Page, req.Limit)
```
- case
if import github.com/olivere/elastic must remove *hit.Source on *
- more 
[link](https://xxjwxc.github.io/post/loglistdef/)