Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dpluger can not check keyword on es6 #392

Merged
merged 6 commits into from
Mar 15, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ignore first mapping type
  • Loading branch information
rkspx committed Mar 15, 2022
commit 217dfdf60fe69f983f4e7b6267c9dd9c813d7297
14 changes: 9 additions & 5 deletions internal/pkg/dpluger/es6client.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,19 @@ func (es *es6Client) FieldType(ctx context.Context, index string, field string)

var fiedMapping map[string]interface{}
var ok bool
MAPPING_SEARCH:
for _, v := range m {
fm, exist := v.(map[string]interface{})["mappings"].(map[string]interface{})[field]
if !exist {
fm, fmok := v.(map[string]interface{})["mappings"].(map[string]interface{})
if !fmok {
continue
}

fiedMapping, ok = fm.(map[string]interface{})
if ok {
break
for _, val := range fm {
// get the first child that has the mapping for the field
fiedMapping, ok = val.(map[string]interface{})[field].(map[string]interface{})
if ok {
break MAPPING_SEARCH
}
}

}
Expand Down