0
0
Fork 0

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:
Marty Schoch 2015-12-08 13:55:04 -05:00
parent 9d30e1c96b
commit d73beac3b9
2 changed files with 7 additions and 0 deletions

View File

@ -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)
searchDuration := time.Since(searchStart)
atomic.AddUint64(&i.stats.searchTime, uint64(searchDuration))

View File

@ -51,6 +51,7 @@ type FieldTermLocationMap map[string]TermLocationMap
type FieldFragmentMap map[string][]string
type DocumentMatch struct {
Index string `json:"index,omitempty"`
ID string `json:"id"`
Score float64 `json:"score"`
Expl *Explanation `json:"explanation,omitempty"`