search result hits now have a field with the name of the index
this allows you to figure out where a result actually came from when using aliases
This commit is contained in:
parent
9d30e1c96b
commit
d73beac3b9
@ -497,6 +497,12 @@ func (i *indexImpl) Search(req *SearchRequest) (sr *SearchResult, err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, hit := range hits {
|
||||||
|
if i.name != "" {
|
||||||
|
hit.Index = i.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
atomic.AddUint64(&i.stats.searches, 1)
|
atomic.AddUint64(&i.stats.searches, 1)
|
||||||
searchDuration := time.Since(searchStart)
|
searchDuration := time.Since(searchStart)
|
||||||
atomic.AddUint64(&i.stats.searchTime, uint64(searchDuration))
|
atomic.AddUint64(&i.stats.searchTime, uint64(searchDuration))
|
||||||
|
@ -51,6 +51,7 @@ type FieldTermLocationMap map[string]TermLocationMap
|
|||||||
type FieldFragmentMap map[string][]string
|
type FieldFragmentMap map[string][]string
|
||||||
|
|
||||||
type DocumentMatch struct {
|
type DocumentMatch struct {
|
||||||
|
Index string `json:"index,omitempty"`
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Score float64 `json:"score"`
|
Score float64 `json:"score"`
|
||||||
Expl *Explanation `json:"explanation,omitempty"`
|
Expl *Explanation `json:"explanation,omitempty"`
|
||||||
|
Loading…
Reference in New Issue
Block a user