func New(path string, mapping mapping.IndexMapping) (Index, error) {
	return newIndexUsing(path, mapping, Config.DefaultIndexType, Config.DefaultKVStore, nil)
}
New index at the specified path, must not exist.
The provided mapping will be used for all
Index/Search operations.
package bleve
import (
	"context"
	"github.com/blevesearch/bleve/v2/index/upsidedown"
	"github.com/blevesearch/bleve/v2/document"
	"github.com/blevesearch/bleve/v2/mapping"
	"github.com/blevesearch/bleve/v2/size"
	index "github.com/blevesearch/bleve_index_api"
)
type Batch struct {
	index    Index
	internal *index.Batch
	lastDocSize uint64
	totalSize   uint64
}
func (b *Batch) Index(id string, data interface{}) error {
	if id == "" {
		return ErrorEmptyID
	}
	doc := document.NewDocument(id)
	err := b.index.Mapping().MapDocument(doc, data)
	if err != nil {
		return err
	}
	b.internal.Update(doc)
	b.lastDocSize = uint64(doc.Size() +
		len(id) + size.SizeOfString)  
	b.totalSize += b.lastDocSize
	return nil
}
func (b *Batch) LastDocSize() uint64 {
	return b.lastDocSize
}
func (b *Batch) TotalDocsSize() uint64 {
	return b.totalSize
}
func (b *Batch) IndexAdvanced(doc *document.Document) (err error) {
	if doc.ID() == "" {
		return ErrorEmptyID
	}
	b.internal.Update(doc)
	return nil
}
func (b *Batch) Delete(id string) {
	if id != "" {
		b.internal.Delete(id)
	}
}
func (b *Batch) SetInternal(key, val []byte) {
	b.internal.SetInternal(key, val)
}
func (b *Batch) DeleteInternal(key []byte) {
	b.internal.DeleteInternal(key)
}
func (b *Batch) Size() int {
	return len(b.internal.IndexOps) + len(b.internal.InternalOps)
}
func (b *Batch) String() string {
	return b.internal.String()
}
func (b *Batch) Reset() {
	b.internal.Reset()
	b.lastDocSize = 0
	b.totalSize = 0
}
func (b *Batch) Merge(o *Batch) {
	if o != nil && o.internal != nil {
		b.internal.Merge(o.internal)
		if o.LastDocSize() > 0 {
			b.lastDocSize = o.LastDocSize()
		}
		b.totalSize = uint64(b.internal.TotalDocSize())
	}
}
func (b *Batch) SetPersistedCallback(f index.BatchCallback) {
	b.internal.SetPersistedCallback(f)
}
func (b *Batch) PersistedCallback() index.BatchCallback {
	return b.internal.PersistedCallback()
}
type Index interface {
	Index(id string, data interface{}) error
	Delete(id string) error
	NewBatch() *Batch
	Batch(b *Batch) error
	Document(id string) (index.Document, error)
	DocCount() (uint64, error)
	Search(req *SearchRequest) (*SearchResult, error)
	SearchInContext(ctx context.Context, req *SearchRequest) (*SearchResult, error)
	Fields() ([]string, error)
	FieldDict(field string) (index.FieldDict, error)
	FieldDictRange(field string, startTerm []byte, endTerm []byte) (index.FieldDict, error)
	FieldDictPrefix(field string, termPrefix []byte) (index.FieldDict, error)
	Close() error
	Mapping() mapping.IndexMapping
	Stats() *IndexStat
	StatsMap() map[string]interface{}
	GetInternal(key []byte) ([]byte, error)
	SetInternal(key, val []byte) error
	DeleteInternal(key []byte) error
	Name() string
	SetName(string)
	Advanced() (index.Index, error)
}