Skip to content

Commit d5bc6d6

Browse files
authored
Move analysis/mappings stats to cluster-stats. (#51260)
Closes #51138
1 parent 5b5bdd1 commit d5bc6d6

File tree

23 files changed

+1140
-813
lines changed

23 files changed

+1140
-813
lines changed

docs/reference/cluster/stats.asciidoc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,19 @@ The API returns the following response:
438438
"fixed_bit_set_memory_in_bytes": 0,
439439
"max_unsafe_auto_id_timestamp" : -9223372036854775808,
440440
"file_sizes": {}
441+
},
442+
"mappings": {
443+
"field_types": []
444+
},
445+
"analysis": {
446+
"char_filter_types": [],
447+
"tokenizer_types": [],
448+
"filter_types": [],
449+
"analyzer_types": [],
450+
"built_in_char_filters": [],
451+
"built_in_tokenizers": [],
452+
"built_in_filters": [],
453+
"built_in_analyzers": []
441454
}
442455
},
443456
"nodes": {
@@ -554,6 +567,7 @@ The API returns the following response:
554567
// TESTRESPONSE[s/"processor_stats": \{[^\}]*\}/"processor_stats": $body.$_path/]
555568
// TESTRESPONSE[s/"count": \{[^\}]*\}/"count": $body.$_path/]
556569
// TESTRESPONSE[s/"packaging_types": \[[^\]]*\]/"packaging_types": $body.$_path/]
570+
// TESTRESPONSE[s/"field_types": \[[^\]]*\]/"field_types": $body.$_path/]
557571
// TESTRESPONSE[s/: true|false/: $body.$_path/]
558572
// TESTRESPONSE[s/: (\-)?[0-9]+/: $body.$_path/]
559573
// TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
"get cluster stats returns analysis stats":
3+
4+
- skip:
5+
version: " - 7.99.99" # TODO: 7.6.99
6+
reason: "analysis stats are added for v7.7.0"
7+
8+
- do:
9+
cluster.stats: {}
10+
11+
- length: { indices.analysis.char_filter_types: 0 }
12+
- length: { indices.analysis.tokenizer_types: 0 }
13+
- length: { indices.analysis.filter_types: 0 }
14+
- length: { indices.analysis.analyzer_types: 0 }
15+
16+
- length: { indices.analysis.built_in_char_filters: 0 }
17+
- length: { indices.analysis.built_in_tokenizers: 0 }
18+
- length: { indices.analysis.built_in_filters: 0 }
19+
- length: { indices.analysis.built_in_analyzers: 0 }
20+
21+
- do:
22+
indices.create:
23+
index: test-index1
24+
body:
25+
settings:
26+
analysis:
27+
char_filter:
28+
c:
29+
type: mapping
30+
mappings: [ "a => b" ]
31+
tokenizer:
32+
tok:
33+
type: pattern
34+
pattern: ","
35+
filter:
36+
st:
37+
type: stop
38+
stopwords: [ "a" ]
39+
st2:
40+
type: stop
41+
stopwords: [ "b" ]
42+
analyzer:
43+
en:
44+
type: standard
45+
stopwords: "_english_"
46+
cust:
47+
char_filter: [ "html_strip" ]
48+
tokenizer: "keyword"
49+
filter: [ "trim" ]
50+
mappings:
51+
properties:
52+
message:
53+
type: "text"
54+
analyzer: french
55+
search_analyzer: spanish
56+
search_quote_analyzer: german
57+
description:
58+
type: "text"
59+
analyzer: french
60+
61+
- do:
62+
indices.create:
63+
index: test-index2
64+
body:
65+
mappings:
66+
properties:
67+
message:
68+
type: "text"
69+
analyzer: spanish
70+
71+
- do:
72+
cluster.stats: {}
73+
74+
- length: { indices.analysis.char_filter_types: 1 }
75+
- match: { indices.analysis.char_filter_types.0.name: mapping }
76+
- match: { indices.analysis.char_filter_types.0.count: 1 }
77+
- match: { indices.analysis.char_filter_types.0.index_count: 1 }
78+
79+
- length: { indices.analysis.tokenizer_types: 1 }
80+
- match: { indices.analysis.tokenizer_types.0.name: pattern }
81+
- match: { indices.analysis.tokenizer_types.0.count: 1 }
82+
- match: { indices.analysis.tokenizer_types.0.index_count: 1 }
83+
84+
- length: { indices.analysis.filter_types: 1 }
85+
- match: { indices.analysis.filter_types.0.name: stop }
86+
- match: { indices.analysis.filter_types.0.count: 2 }
87+
- match: { indices.analysis.filter_types.0.index_count: 1 }
88+
89+
- length: { indices.analysis.analyzer_types: 2 }
90+
- match: { indices.analysis.analyzer_types.0.name: custom }
91+
- match: { indices.analysis.analyzer_types.0.count: 1 }
92+
- match: { indices.analysis.analyzer_types.0.index_count: 1 }
93+
- match: { indices.analysis.analyzer_types.1.name: standard }
94+
- match: { indices.analysis.analyzer_types.1.count: 1 }
95+
- match: { indices.analysis.analyzer_types.1.index_count: 1 }
96+
97+
- length: { indices.analysis.built_in_char_filters: 1 }
98+
- match: { indices.analysis.built_in_char_filters.0.name: html_strip }
99+
- match: { indices.analysis.built_in_char_filters.0.count: 1 }
100+
- match: { indices.analysis.built_in_char_filters.0.index_count: 1 }
101+
102+
- length: { indices.analysis.built_in_tokenizers: 1 }
103+
- match: { indices.analysis.built_in_tokenizers.0.name: keyword }
104+
- match: { indices.analysis.built_in_tokenizers.0.count: 1 }
105+
- match: { indices.analysis.built_in_tokenizers.0.index_count: 1 }
106+
107+
- length: { indices.analysis.built_in_filters: 1 }
108+
- match: { indices.analysis.built_in_filters.0.name: trim }
109+
- match: { indices.analysis.built_in_filters.0.count: 1 }
110+
- match: { indices.analysis.built_in_filters.0.index_count: 1 }
111+
112+
- length: { indices.analysis.built_in_analyzers: 3 }
113+
- match: { indices.analysis.built_in_analyzers.0.name: french }
114+
- match: { indices.analysis.built_in_analyzers.0.count: 2 }
115+
- match: { indices.analysis.built_in_analyzers.0.index_count: 1 }
116+
- match: { indices.analysis.built_in_analyzers.1.name: german }
117+
- match: { indices.analysis.built_in_analyzers.1.count: 1 }
118+
- match: { indices.analysis.built_in_analyzers.1.index_count: 1 }
119+
- match: { indices.analysis.built_in_analyzers.2.name: spanish }
120+
- match: { indices.analysis.built_in_analyzers.2.count: 2 }
121+
- match: { indices.analysis.built_in_analyzers.2.index_count: 2 }
122+

rest-api-spec/src/main/resources/rest-api-spec/test/cluster.stats/10_basic.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,57 @@
8383
cluster.stats: {}
8484

8585
- is_true: nodes.packaging_types
86+
87+
---
88+
"get cluster stats returns mapping stats":
89+
90+
- skip:
91+
version: " - 7.99.99" # TODO: 7.6.99
92+
reason: "mapping stats are added for v7.7.0"
93+
94+
- do:
95+
cluster.stats: {}
96+
97+
- length: { indices.mappings.field_types: 0 }
98+
99+
- do:
100+
indices.create:
101+
index: test-index1
102+
body:
103+
mappings:
104+
properties:
105+
foo:
106+
type: keyword
107+
108+
- do:
109+
indices.create:
110+
index: test-index2
111+
body:
112+
mappings:
113+
properties:
114+
foo:
115+
type: keyword
116+
bar:
117+
properties:
118+
quux:
119+
type: integer
120+
baz:
121+
type: keyword
122+
123+
- do:
124+
cluster.stats: {}
125+
126+
- length: { indices.mappings.field_types: 3 }
127+
128+
- match: { indices.mappings.field_types.0.name: integer }
129+
- match: { indices.mappings.field_types.0.count: 1 }
130+
- match: { indices.mappings.field_types.0.index_count: 1 }
131+
132+
- match: { indices.mappings.field_types.1.name: keyword }
133+
- match: { indices.mappings.field_types.1.count: 3 }
134+
- match: { indices.mappings.field_types.1.index_count: 2 }
135+
136+
- match: { indices.mappings.field_types.2.name: object }
137+
- match: { indices.mappings.field_types.2.count: 1 }
138+
- match: { indices.mappings.field_types.2.index_count: 1 }
139+

0 commit comments

Comments
 (0)