mattermost-community-enterp.../vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_document-explain.go
Claude ec1f89217a Merge: Complete Mattermost Server with Community Enterprise
Full Mattermost server source with integrated Community Enterprise features.
Includes vendor directory for offline/air-gapped builds.

Structure:
- enterprise-impl/: Enterprise feature implementations
- enterprise-community/: Init files that register implementations
- enterprise/: Bridge imports (community_imports.go)
- vendor/: All dependencies for offline builds

Build (online):
  go build ./cmd/mattermost

Build (offline/air-gapped):
  go build -mod=vendor ./cmd/mattermost

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 23:59:07 +09:00

60 lines
1.7 KiB
Go

// SPDX-License-Identifier: Apache-2.0
//
// The OpenSearch Contributors require contributions made to
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.
package opensearchapi
import (
"fmt"
"io"
"net/http"
"github.com/opensearch-project/opensearch-go/v4"
)
// DocumentExplainReq represents possible options for the /<Index>/_explain/<DocumentID> request
type DocumentExplainReq struct {
Index string
DocumentID string
Body io.Reader
Header http.Header
Params DocumentExplainParams
}
// GetRequest returns the *http.Request that gets executed by the client
func (r DocumentExplainReq) GetRequest() (*http.Request, error) {
return opensearch.BuildRequest(
"POST",
fmt.Sprintf("/%s/_explain/%s", r.Index, r.DocumentID),
r.Body,
r.Params.get(),
r.Header,
)
}
// DocumentExplainResp represents the returned struct of the /<Index>/_explain/<DocumentID> response
type DocumentExplainResp struct {
Index string `json:"_index"`
ID string `json:"_id"`
Type string `json:"_type"` // Deprecated field
Matched bool `json:"matched"`
Explanation DocumentExplainDetails `json:"explanation"`
response *opensearch.Response
}
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
func (r DocumentExplainResp) Inspect() Inspect {
return Inspect{Response: r.response}
}
// DocumentExplainDetails is a sub type of DocumentExplainResp containing information about why a query does what it does
type DocumentExplainDetails struct {
Value float64 `json:"value"`
Description string `json:"description"`
Details []DocumentExplainDetails `json:"details"`
}