diff --git a/http/doc_index.go b/http/doc_index.go index d51a0bc31..c81be04d5 100644 --- a/http/doc_index.go +++ b/http/doc_index.go @@ -25,6 +25,7 @@ type DocIndexHandler struct { defaultIndexName string IndexNameLookup varLookupFunc DocIDLookup varLookupFunc + IndexDocType map[string]interface{} } func NewDocIndexHandler(defaultIndexName string) *DocIndexHandler { @@ -68,6 +69,12 @@ func (h *DocIndexHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { // parse request body as json var doc interface{} + if nil != h.IndexDocType { + if v, ok := h.IndexDocType[indexName]; ok { + doc = v + } + } + err = json.Unmarshal(requestBody, &doc) if err != nil { showError(w, req, fmt.Sprintf("error parsing request body as JSON: %v", err), 400)