---
"Test analyze API with the standard 7.16 ML analyzer":
  - do:
      indices.analyze:
        body:  >
          {
            "char_filter" : [
              "first_line_with_letters"
            ],
            "tokenizer" : "ml_standard",
            "filter" : [
              { "type" : "stop", "stopwords": [
                "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday",
                "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
                "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December",
                "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
                "GMT", "UTC"
              ] }
            ],
            "text" : "[elasticsearch] [2017-12-13T10:46:30,816][INFO ][o.e.c.m.MetadataCreateIndexService] [node-0] [.watcher-history-7-2017.12.13] creating index, cause [auto(bulk api)], templates [.watch-history-7], shards [1]/[1], mappings [doc]"
          }
  - match: { tokens.0.token: "elasticsearch" }
  - match: { tokens.0.start_offset: 1 }
  - match: { tokens.0.end_offset: 14 }
  - match: { tokens.0.position: 0 }
  - match: { tokens.1.token: "INFO" }
  - match: { tokens.1.start_offset: 42 }
  - match: { tokens.1.end_offset: 46 }
  - match: { tokens.1.position: 5 }
  - match: { tokens.2.token: "o.e.c.m.MetadataCreateIndexService" }
  - match: { tokens.2.start_offset: 49 }
  - match: { tokens.2.end_offset: 83 }
  - match: { tokens.2.position: 6 }
  - match: { tokens.3.token: "node-0" }
  - match: { tokens.3.start_offset: 86 }
  - match: { tokens.3.end_offset: 92 }
  - match: { tokens.3.position: 7 }
  - match: { tokens.4.token: "watcher-history-7-2017.12.13" }
  - match: { tokens.4.start_offset: 96 }
  - match: { tokens.4.end_offset: 124 }
  - match: { tokens.4.position: 8 }
  - match: { tokens.5.token: "creating" }
  - match: { tokens.5.start_offset: 126 }
  - match: { tokens.5.end_offset: 134 }
  - match: { tokens.5.position: 9 }
  - match: { tokens.6.token: "index" }
  - match: { tokens.6.start_offset: 135 }
  - match: { tokens.6.end_offset: 140 }
  - match: { tokens.6.position: 10 }
  - match: { tokens.7.token: "cause" }
  - match: { tokens.7.start_offset: 142 }
  - match: { tokens.7.end_offset: 147 }
  - match: { tokens.7.position: 11 }
  - match: { tokens.8.token: "auto" }
  - match: { tokens.8.start_offset: 149 }
  - match: { tokens.8.end_offset: 153 }
  - match: { tokens.8.position: 12 }
  - match: { tokens.9.token: "bulk" }
  - match: { tokens.9.start_offset: 154 }
  - match: { tokens.9.end_offset: 158 }
  - match: { tokens.9.position: 13 }
  - match: { tokens.10.token: "api" }
  - match: { tokens.10.start_offset: 159 }
  - match: { tokens.10.end_offset: 162 }
  - match: { tokens.10.position: 14 }
  - match: { tokens.11.token: "templates" }
  - match: { tokens.11.start_offset: 166 }
  - match: { tokens.11.end_offset: 175 }
  - match: { tokens.11.position: 15 }
  - match: { tokens.12.token: "watch-history-7" }
  - match: { tokens.12.start_offset: 178 }
  - match: { tokens.12.end_offset: 193 }
  - match: { tokens.12.position: 16 }
  - match: { tokens.13.token: "shards" }
  - match: { tokens.13.start_offset: 196 }
  - match: { tokens.13.end_offset: 202 }
  - match: { tokens.13.position: 17 }
  - match: { tokens.14.token: "mappings" }
  - match: { tokens.14.start_offset: 212 }
  - match: { tokens.14.end_offset: 220 }
  - match: { tokens.14.position: 21 }
  - match: { tokens.15.token: "doc" }
  - match: { tokens.15.start_offset: 222 }
  - match: { tokens.15.end_offset: 225 }
  - match: { tokens.15.position: 22 }

---
"Test 7.16 analyzer with blank lines":
  - do:
      indices.analyze:
        body:  >
          {
            "char_filter" : [
              "first_line_with_letters"
            ],
            "tokenizer" : "ml_standard",
            "filter" : [
              { "type" : "stop", "stopwords": [
                "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday",
                "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
                "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December",
                "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
                "GMT", "UTC"
              ] }
            ],
            "text" : "   \nfirst line\nsecond line"
          }
  - match: { tokens.0.token: "first" }
  - match: { tokens.0.start_offset: 4 }
  - match: { tokens.0.end_offset: 9 }
  - match: { tokens.0.position: 0 }
  - match: { tokens.1.token: "line" }
  - match: { tokens.1.start_offset: 10 }
  - match: { tokens.1.end_offset: 26 }
  - match: { tokens.1.position: 1 }

---
"Test 7.16 analyzer with multiple multiline messages":
  - do:
      indices.analyze:
        body:  >
          {
            "char_filter" : [
              "first_line_with_letters"
            ],
            "tokenizer" : "ml_standard",
            "filter" : [
              { "type" : "stop", "stopwords": [
                "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday",
                "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
                "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December",
                "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
                "GMT", "UTC"
              ] }
            ],
            "text" : [
              "   \nfirst line\nsecond line",
              "   \nfirst line of second message\nsecond line of second message"
            ]
          }
  - match: { tokens.0.token: "first" }
  - match: { tokens.0.start_offset: 4 }
  - match: { tokens.0.end_offset: 9 }
  - match: { tokens.0.position: 0 }
  - match: { tokens.1.token: "line" }
  - match: { tokens.1.start_offset: 10 }
  - match: { tokens.1.end_offset: 26 }
  - match: { tokens.1.position: 1 }
  - match: { tokens.2.token: "first" }
  - match: { tokens.2.start_offset: 31 }
  - match: { tokens.2.end_offset: 36 }
  - match: { tokens.2.position: 102 }
  - match: { tokens.3.token: "line" }
  - match: { tokens.3.start_offset: 37 }
  - match: { tokens.3.end_offset: 41 }
  - match: { tokens.3.position: 103 }
  - match: { tokens.4.token: "of" }
  - match: { tokens.4.start_offset: 42 }
  - match: { tokens.4.end_offset: 44 }
  - match: { tokens.4.position: 104 }
  - match: { tokens.5.token: "second" }
  - match: { tokens.5.start_offset: 45 }
  - match: { tokens.5.end_offset: 51 }
  - match: { tokens.5.position: 105 }
  - match: { tokens.6.token: "message" }
  - match: { tokens.6.start_offset: 52 }
  - match: { tokens.6.end_offset: 89 }
  - match: { tokens.6.position: 106 }

---
"Test 7.16 analyzer with stop words in messages":
  - do:
      indices.analyze:
        body:  >
          {
            "char_filter" : [
              "first_line_with_letters"
            ],
            "tokenizer" : "ml_standard",
            "filter" : [
              { "type" : "stop", "stopwords": [
                "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday",
                "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
                "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December",
                "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
                "GMT", "UTC"
              ] }
            ],
            "text" : [
              "May 27, 2021 @ 19:51:15.288 UTC log message one",
              "May 27, 2021 @ 19:52:25.288 UTC log message two"
            ]
          }
  - match: { tokens.0.token: "log" }
  - match: { tokens.0.start_offset: 32 }
  - match: { tokens.0.end_offset: 35 }
  - match: { tokens.0.position: 7 }
  - match: { tokens.1.token: "message" }
  - match: { tokens.1.start_offset: 36 }
  - match: { tokens.1.end_offset: 43 }
  - match: { tokens.1.position: 8 }
  - match: { tokens.2.token: "one" }
  - match: { tokens.2.start_offset: 44 }
  - match: { tokens.2.end_offset: 47 }
  - match: { tokens.2.position: 9 }
  - match: { tokens.3.token: "log" }
  - match: { tokens.3.start_offset: 80 }
  - match: { tokens.3.end_offset: 83 }
  - match: { tokens.3.position: 117 }
  - match: { tokens.4.token: "message" }
  - match: { tokens.4.start_offset: 84 }
  - match: { tokens.4.end_offset: 91 }
  - match: { tokens.4.position: 118 }
  - match: { tokens.5.token: "two" }
  - match: { tokens.5.start_offset: 92 }
  - match: { tokens.5.end_offset: 95 }
  - match: { tokens.5.position: 119 }
---
"Test 7.16 analyzer with stop words in messages and strange lines without letters":
  - do:
      indices.analyze:
        body:  >
          {
            "char_filter" : [
              "first_line_with_letters"
            ],
            "tokenizer" : "ml_standard",
            "filter" : [
              { "type" : "stop", "stopwords": [
                "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday",
                "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
                "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December",
                "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
                "GMT", "UTC"
              ] }
            ],
            "text" : [
              "\n-----\nMay 27, 2021 @ 19:51:15.288 UTC log message one\n-----\n",
              "\n-----\nMay 27, 2021 @ 19:52:25.288 UTC log message two\n-----\n"
            ]
          }
  - match: { tokens.0.token: "log" }
  - match: { tokens.0.start_offset: 39 }
  - match: { tokens.0.end_offset: 42 }
  - match: { tokens.0.position: 7 }
  - match: { tokens.1.token: "message" }
  - match: { tokens.1.start_offset: 43 }
  - match: { tokens.1.end_offset: 50 }
  - match: { tokens.1.position: 8 }
  - match: { tokens.2.token: "one" }
  - match: { tokens.2.start_offset: 51 }
  - match: { tokens.2.end_offset: 61 }
  - match: { tokens.2.position: 9 }
  - match: { tokens.3.token: "log" }
  - match: { tokens.3.start_offset: 101 }
  - match: { tokens.3.end_offset: 104 }
  - match: { tokens.3.position: 117 }
  - match: { tokens.4.token: "message" }
  - match: { tokens.4.start_offset: 105 }
  - match: { tokens.4.end_offset: 112 }
  - match: { tokens.4.position: 118 }
  - match: { tokens.5.token: "two" }
  - match: { tokens.5.start_offset: 113 }
  - match: { tokens.5.end_offset: 123 }
  - match: { tokens.5.position: 119 }
