Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit c6db0b3

Browse files
trzysiekpdelewski
andauthored
[done, needs some testing] Revert Text/keyword change? (#1386)
Before this PR all sample dashboards load in Kibana 8.11, but one single panel doesn't in newest Kibana 8.17. After this PR they all load in both of them. #1321 Draft for a bit, let me inspect a) PR above b) the customer case which was why I also introduced the reverse change a few months ago (we used to have exactly the same version in code as after this PR months ago) --------- Co-authored-by: Przemek Delewski <[email protected]>
1 parent c0733e4 commit c6db0b3

File tree

2 files changed

+158
-175
lines changed

2 files changed

+158
-175
lines changed

platform/functionality/field_capabilities/field_caps.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ func handleFieldCapsIndex(cfg map[string]config.IndexConfiguration, schemaRegist
7070
for fieldName, field := range fieldsWithAliases {
7171
addFieldCapabilityFromSchemaRegistry(fields, fieldName.AsString(), field.Type, resolvedIndex)
7272
switch field.Type.Name {
73-
case "keyword", "text":
73+
case "text":
7474
addFieldCapabilityFromSchemaRegistry(fields, fmt.Sprintf("%s%s", fieldName.AsString(), types.MultifieldKeywordSuffix), schema.QuesmaTypeKeyword, resolvedIndex)
75+
case "keyword":
7576
addFieldCapabilityFromSchemaRegistry(fields, fmt.Sprintf("%s%s", fieldName.AsString(), types.MultifieldTextSuffix), schema.QuesmaTypeText, resolvedIndex)
7677
}
7778
}

platform/functionality/field_capabilities/field_caps_test.go

Lines changed: 156 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -15,83 +15,77 @@ import (
1515

1616
func TestFieldCaps(t *testing.T) {
1717
expected := []byte(`{
18-
"fields": {
19-
"arrayOfArraysOfStrings": {
20-
"keyword": {
21-
"aggregatable": true,
22-
"searchable": true,
23-
"type": "keyword",
24-
"metadata_field": false,
25-
"indices": ["logs-generic-default"]
26-
}
27-
},
28-
"arrayOfArraysOfStrings.keyword": {
29-
"keyword": {
30-
"aggregatable": true,
31-
"searchable": true,
32-
"type": "keyword",
33-
"metadata_field": false,
34-
"indices": ["logs-generic-default"]
35-
}
36-
},
37-
"arrayOfArraysOfStrings.text": {
38-
"text": {
39-
"type": "text",
40-
"metadata_field": false,
41-
"searchable": true,
42-
"aggregatable": false,
43-
"indices": ["logs-generic-default"]
44-
}
45-
},
46-
"arrayOfTuples": {
47-
"object": {
48-
"aggregatable": false,
49-
"metadata_field": false,
50-
"searchable": true,
51-
"type": "object",
52-
"indices": ["logs-generic-default"]
53-
}
54-
},
55-
"host.name": {
56-
"object": {
57-
"aggregatable": false,
58-
"metadata_field": false,
59-
"searchable": true,
60-
"type": "object",
61-
"indices": ["logs-generic-default"]
62-
}
63-
},
64-
"service.name": {
65-
"keyword": {
66-
"aggregatable": true,
67-
"searchable": true,
68-
"metadata_field": false,
69-
"type": "keyword",
70-
"indices": ["logs-generic-default"]
71-
}
72-
},
73-
"service.name.keyword": {
74-
"keyword": {
75-
"aggregatable": true,
76-
"searchable": true,
77-
"metadata_field": false,
78-
"type": "keyword",
79-
"indices": ["logs-generic-default"]
80-
}
81-
},
82-
"service.name.text": {
83-
"text": {
84-
"aggregatable": false,
85-
"searchable": true,
86-
"metadata_field": false,
87-
"type": "text",
88-
"indices": ["logs-generic-default"]
18+
"fields":{
19+
"arrayOfArraysOfStrings":{
20+
"keyword":{
21+
"aggregatable":true,
22+
"indices":[
23+
"logs-generic-default"
24+
],
25+
"metadata_field":false,
26+
"searchable":true,
27+
"type":"keyword"
28+
}
29+
},
30+
"arrayOfArraysOfStrings.text":{
31+
"text":{
32+
"aggregatable":false,
33+
"indices":[
34+
"logs-generic-default"
35+
],
36+
"metadata_field":false,
37+
"searchable":true,
38+
"type":"text"
39+
}
40+
},
41+
"arrayOfTuples":{
42+
"object":{
43+
"aggregatable":false,
44+
"indices":[
45+
"logs-generic-default"
46+
],
47+
"metadata_field":false,
48+
"searchable":false,
49+
"type":"object"
50+
}
51+
},
52+
"host.name":{
53+
"object":{
54+
"aggregatable":false,
55+
"indices":[
56+
"logs-generic-default"
57+
],
58+
"metadata_field":false,
59+
"searchable":false,
60+
"type":"object"
61+
}
62+
},
63+
"service.name":{
64+
"keyword":{
65+
"aggregatable":true,
66+
"indices":[
67+
"logs-generic-default"
68+
],
69+
"metadata_field":false,
70+
"searchable":true,
71+
"type":"keyword"
72+
}
73+
},
74+
"service.name.text":{
75+
"text":{
76+
"aggregatable":false,
77+
"indices":[
78+
"logs-generic-default"
79+
],
80+
"metadata_field":false,
81+
"searchable":true,
82+
"type":"text"
83+
}
8984
}
90-
}
91-
},
92-
"indices": [
93-
"logs-generic-default"
94-
]
85+
},
86+
"indices":[
87+
"logs-generic-default"
88+
]
9589
}
9690
`)
9791
resp, err := handleFieldCapsIndex(
@@ -122,7 +116,6 @@ func TestFieldCaps(t *testing.T) {
122116
string(resp),
123117
string(expectedResp),
124118
)
125-
126119
assert.NoError(t, err)
127120
assert.Empty(t, difference1)
128121
assert.Empty(t, difference2)
@@ -223,63 +216,56 @@ func TestFieldCapsMultipleIndexes(t *testing.T) {
223216
}, []string{"logs-1", "logs-2"})
224217
assert.NoError(t, err)
225218
expectedResp, err := json.MarshalIndent([]byte(`{
226-
"fields": {
227-
"foo.bar1": {
228-
"text": {
229-
"aggregatable": false,
230-
"indices": ["logs-1"],
231-
"metadata_field": false,
232-
"searchable": true,
233-
"type": "text"
234-
}
235-
},
236-
"foo.bar1.keyword": {
237-
"keyword": {
238-
"aggregatable": true,
239-
"indices": ["logs-1"],
240-
"metadata_field": false,
241-
"searchable": true,
242-
"type": "keyword"
243-
}
244-
},
245-
"foo.bar1.text": {
246-
"text": {
247-
"aggregatable": false,
248-
"indices": ["logs-1"],
249-
"metadata_field": false,
250-
"searchable": true,
251-
"type": "text"
252-
}
253-
},
254-
"foo.bar2": {
255-
"text": {
256-
"aggregatable": false,
257-
"indices": ["logs-2"],
258-
"metadata_field": false,
259-
"searchable": true,
260-
"type": "text"
261-
}
262-
},
263-
"foo.bar2.keyword": {
264-
"keyword": {
265-
"aggregatable": true,
266-
"indices": ["logs-2"],
267-
"metadata_field": false,
268-
"searchable": true,
269-
"type": "keyword"
270-
}
271-
},
272-
"foo.bar2.text": {
273-
"text": {
274-
"aggregatable": false,
275-
"indices": ["logs-2"],
276-
"metadata_field": false,
277-
"searchable": true,
278-
"type": "text"
219+
"fields":{
220+
"foo.bar1":{
221+
"text":{
222+
"aggregatable":false,
223+
"indices":[
224+
"logs-1"
225+
],
226+
"metadata_field":false,
227+
"searchable":true,
228+
"type":"text"
229+
}
230+
},
231+
"foo.bar1.keyword":{
232+
"keyword":{
233+
"aggregatable":true,
234+
"indices":[
235+
"logs-1"
236+
],
237+
"metadata_field":false,
238+
"searchable":true,
239+
"type":"keyword"
240+
}
241+
},
242+
"foo.bar2":{
243+
"text":{
244+
"aggregatable":false,
245+
"indices":[
246+
"logs-2"
247+
],
248+
"metadata_field":false,
249+
"searchable":true,
250+
"type":"text"
251+
}
252+
},
253+
"foo.bar2.keyword":{
254+
"keyword":{
255+
"aggregatable":true,
256+
"indices":[
257+
"logs-2"
258+
],
259+
"metadata_field":false,
260+
"searchable":true,
261+
"type":"keyword"
262+
}
279263
}
280-
}
281-
},
282-
"indices": ["logs-1", "logs-2"]
264+
},
265+
"indices":[
266+
"logs-1",
267+
"logs-2"
268+
]
283269
}
284270
`), "", " ")
285271
assert.NoError(t, err)
@@ -290,7 +276,6 @@ func TestFieldCapsMultipleIndexes(t *testing.T) {
290276
string(resp),
291277
string(expectedResp),
292278
)
293-
294279
assert.NoError(t, err)
295280
assert.Empty(t, difference1)
296281
assert.Empty(t, difference2)
@@ -351,53 +336,50 @@ func TestFieldCapsMultipleIndexesConflictingEntries(t *testing.T) {
351336
}, []string{"logs-1", "logs-2", "logs-3"})
352337
assert.NoError(t, err)
353338
expectedResp, err := json.MarshalIndent([]byte(`{
354-
"fields": {
355-
"foo.bar": {
356-
"keyword": {
357-
"aggregatable": true,
358-
"searchable": true,
359-
"metadata_field": false,
360-
"type": "keyword",
361-
"indices": ["logs-1"]
339+
"fields":{
340+
"foo.bar":{
341+
"boolean":{
342+
"aggregatable":true,
343+
"indices":[
344+
"logs-2",
345+
"logs-3"
346+
],
347+
"metadata_field":false,
348+
"searchable":true,
349+
"type":"boolean"
350+
},
351+
"keyword":{
352+
"aggregatable":true,
353+
"indices":[
354+
"logs-1"
355+
],
356+
"metadata_field":false,
357+
"searchable":true,
358+
"type":"keyword"
359+
}
362360
},
363-
"boolean": {
364-
"aggregatable": false,
365-
"searchable": true,
366-
"metadata_field": false,
367-
"type": "boolean",
368-
"indices": ["logs-2", "logs-3"]
361+
"foo.bar.text":{
362+
"text":{
363+
"aggregatable":false,
364+
"indices":[
365+
"logs-1"
366+
],
367+
"metadata_field":false,
368+
"searchable":true,
369+
"type":"text"
370+
}
369371
}
370-
},
371-
"foo.bar.keyword": {
372-
"keyword": {
373-
"aggregatable": false,
374-
"searchable": true,
375-
"metadata_field": false,
376-
"type": "keyword",
377-
"indices": ["logs-1"]
378-
}
379-
},
380-
"foo.bar.text": {
381-
"text": {
382-
"aggregatable": false,
383-
"searchable": true,
384-
"metadata_field": false,
385-
"type": "text",
386-
"indices": ["logs-1"]
387-
}
388-
}
389-
},
390-
"indices": [
391-
"logs-1",
392-
"logs-2",
393-
"logs-3"
394-
]
372+
},
373+
"indices":[
374+
"logs-1",
375+
"logs-2",
376+
"logs-3"
377+
]
395378
}
396379
`), "", " ")
397380
assert.NoError(t, err)
398381
err = json.Unmarshal(expectedResp, &expectedResp)
399382
assert.NoError(t, err)
400-
401383
difference1, difference2, err := util.JsonDifference(
402384
string(resp),
403385
string(expectedResp),

0 commit comments

Comments
 (0)