Skip to content

Commit bc3c29e

Browse files
committed
Handle _parent and _routing attributes in response
1 parent 34c4c4d commit bc3c29e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/baseresponse.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ type BaseResponse struct {
2323
Index string `json:"_index,omitempty"`
2424
Type string `json:"_type,omitempty"`
2525
Id string `json:"_id,omitempty"`
26+
Parent string `json:"_parent,omitempty"` // for parent/child requests
27+
Routing string `json:"_routing,omitempty"`
2628
Source *json.RawMessage `json:"_source,omitempty"` // depends on the schema you've defined
2729
Version int `json:"_version,omitempty"`
2830
Found bool `json:"found,omitempty"`

lib/coresearch.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ type Hit struct {
204204
Index string `json:"_index"`
205205
Type string `json:"_type,omitempty"`
206206
Id string `json:"_id"`
207+
Parent string `json:"_parent,omitempty"` // for parent/child requests
208+
Routing string `json:"_routing,omitempty"`
207209
Score Float32Nullable `json:"_score,omitempty"` // Filters (no query) dont have score, so is null
208210
Source *json.RawMessage `json:"_source"` // marshalling left to consumer
209211
Fields *json.RawMessage `json:"fields"` // when a field arg is passed to ES, instead of _source it returns fields

0 commit comments

Comments
 (0)