Skip to content

Commit

Permalink
Move analysis/mappings stats to cluster-stats. (#51260)
Browse files Browse the repository at this point in the history
Closes #51138
  • Loading branch information
jpountz authored Feb 4, 2020
1 parent 5b5bdd1 commit d5bc6d6
Show file tree
Hide file tree
Showing 23 changed files with 1,140 additions and 813 deletions.
14 changes: 14 additions & 0 deletions docs/reference/cluster/stats.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,19 @@ The API returns the following response:
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp" : -9223372036854775808,
"file_sizes": {}
},
"mappings": {
"field_types": []
},
"analysis": {
"char_filter_types": [],
"tokenizer_types": [],
"filter_types": [],
"analyzer_types": [],
"built_in_char_filters": [],
"built_in_tokenizers": [],
"built_in_filters": [],
"built_in_analyzers": []
}
},
"nodes": {
Expand Down Expand Up @@ -554,6 +567,7 @@ The API returns the following response:
// TESTRESPONSE[s/"processor_stats": \{[^\}]*\}/"processor_stats": $body.$_path/]
// TESTRESPONSE[s/"count": \{[^\}]*\}/"count": $body.$_path/]
// TESTRESPONSE[s/"packaging_types": \[[^\]]*\]/"packaging_types": $body.$_path/]
// TESTRESPONSE[s/"field_types": \[[^\]]*\]/"field_types": $body.$_path/]
// TESTRESPONSE[s/: true|false/: $body.$_path/]
// TESTRESPONSE[s/: (\-)?[0-9]+/: $body.$_path/]
// TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
"get cluster stats returns analysis stats":

- skip:
version: " - 7.99.99" # TODO: 7.6.99
reason: "analysis stats are added for v7.7.0"

- do:
cluster.stats: {}

- length: { indices.analysis.char_filter_types: 0 }
- length: { indices.analysis.tokenizer_types: 0 }
- length: { indices.analysis.filter_types: 0 }
- length: { indices.analysis.analyzer_types: 0 }

- length: { indices.analysis.built_in_char_filters: 0 }
- length: { indices.analysis.built_in_tokenizers: 0 }
- length: { indices.analysis.built_in_filters: 0 }
- length: { indices.analysis.built_in_analyzers: 0 }

- do:
indices.create:
index: test-index1
body:
settings:
analysis:
char_filter:
c:
type: mapping
mappings: [ "a => b" ]
tokenizer:
tok:
type: pattern
pattern: ","
filter:
st:
type: stop
stopwords: [ "a" ]
st2:
type: stop
stopwords: [ "b" ]
analyzer:
en:
type: standard
stopwords: "_english_"
cust:
char_filter: [ "html_strip" ]
tokenizer: "keyword"
filter: [ "trim" ]
mappings:
properties:
message:
type: "text"
analyzer: french
search_analyzer: spanish
search_quote_analyzer: german
description:
type: "text"
analyzer: french

- do:
indices.create:
index: test-index2
body:
mappings:
properties:
message:
type: "text"
analyzer: spanish

- do:
cluster.stats: {}

- length: { indices.analysis.char_filter_types: 1 }
- match: { indices.analysis.char_filter_types.0.name: mapping }
- match: { indices.analysis.char_filter_types.0.count: 1 }
- match: { indices.analysis.char_filter_types.0.index_count: 1 }

- length: { indices.analysis.tokenizer_types: 1 }
- match: { indices.analysis.tokenizer_types.0.name: pattern }
- match: { indices.analysis.tokenizer_types.0.count: 1 }
- match: { indices.analysis.tokenizer_types.0.index_count: 1 }

- length: { indices.analysis.filter_types: 1 }
- match: { indices.analysis.filter_types.0.name: stop }
- match: { indices.analysis.filter_types.0.count: 2 }
- match: { indices.analysis.filter_types.0.index_count: 1 }

- length: { indices.analysis.analyzer_types: 2 }
- match: { indices.analysis.analyzer_types.0.name: custom }
- match: { indices.analysis.analyzer_types.0.count: 1 }
- match: { indices.analysis.analyzer_types.0.index_count: 1 }
- match: { indices.analysis.analyzer_types.1.name: standard }
- match: { indices.analysis.analyzer_types.1.count: 1 }
- match: { indices.analysis.analyzer_types.1.index_count: 1 }

- length: { indices.analysis.built_in_char_filters: 1 }
- match: { indices.analysis.built_in_char_filters.0.name: html_strip }
- match: { indices.analysis.built_in_char_filters.0.count: 1 }
- match: { indices.analysis.built_in_char_filters.0.index_count: 1 }

- length: { indices.analysis.built_in_tokenizers: 1 }
- match: { indices.analysis.built_in_tokenizers.0.name: keyword }
- match: { indices.analysis.built_in_tokenizers.0.count: 1 }
- match: { indices.analysis.built_in_tokenizers.0.index_count: 1 }

- length: { indices.analysis.built_in_filters: 1 }
- match: { indices.analysis.built_in_filters.0.name: trim }
- match: { indices.analysis.built_in_filters.0.count: 1 }
- match: { indices.analysis.built_in_filters.0.index_count: 1 }

- length: { indices.analysis.built_in_analyzers: 3 }
- match: { indices.analysis.built_in_analyzers.0.name: french }
- match: { indices.analysis.built_in_analyzers.0.count: 2 }
- match: { indices.analysis.built_in_analyzers.0.index_count: 1 }
- match: { indices.analysis.built_in_analyzers.1.name: german }
- match: { indices.analysis.built_in_analyzers.1.count: 1 }
- match: { indices.analysis.built_in_analyzers.1.index_count: 1 }
- match: { indices.analysis.built_in_analyzers.2.name: spanish }
- match: { indices.analysis.built_in_analyzers.2.count: 2 }
- match: { indices.analysis.built_in_analyzers.2.index_count: 2 }

Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,57 @@
cluster.stats: {}

- is_true: nodes.packaging_types

---
"get cluster stats returns mapping stats":

- skip:
version: " - 7.99.99" # TODO: 7.6.99
reason: "mapping stats are added for v7.7.0"

- do:
cluster.stats: {}

- length: { indices.mappings.field_types: 0 }

- do:
indices.create:
index: test-index1
body:
mappings:
properties:
foo:
type: keyword

- do:
indices.create:
index: test-index2
body:
mappings:
properties:
foo:
type: keyword
bar:
properties:
quux:
type: integer
baz:
type: keyword

- do:
cluster.stats: {}

- length: { indices.mappings.field_types: 3 }

- match: { indices.mappings.field_types.0.name: integer }
- match: { indices.mappings.field_types.0.count: 1 }
- match: { indices.mappings.field_types.0.index_count: 1 }

- match: { indices.mappings.field_types.1.name: keyword }
- match: { indices.mappings.field_types.1.count: 3 }
- match: { indices.mappings.field_types.1.index_count: 2 }

- match: { indices.mappings.field_types.2.name: object }
- match: { indices.mappings.field_types.2.count: 1 }
- match: { indices.mappings.field_types.2.index_count: 1 }

Loading

0 comments on commit d5bc6d6

Please sign in to comment.