|
19 | 19 |
|
20 | 20 | package co.elastic.clients.elasticsearch.model;
|
21 | 21 |
|
| 22 | +import co.elastic.clients.elasticsearch._types.analysis.Analyzer; |
22 | 23 | import co.elastic.clients.elasticsearch._types.mapping.Property;
|
23 | 24 | import co.elastic.clients.elasticsearch._types.mapping.TypeMapping;
|
24 | 25 | import co.elastic.clients.elasticsearch._types.query_dsl.FunctionScore;
|
|
29 | 30 | import co.elastic.clients.json.JsonData;
|
30 | 31 | import org.junit.jupiter.api.Test;
|
31 | 32 |
|
| 33 | +import java.util.function.Consumer; |
| 34 | + |
32 | 35 | public class VariantsTest extends ModelTestCase {
|
33 | 36 |
|
34 | 37 | @Test
|
@@ -102,6 +105,24 @@ public void testInternalTag() {
|
102 | 105 | assertTrue(property.ip().fields().get("a-field").float_().coerce());
|
103 | 106 | }
|
104 | 107 |
|
| 108 | + @Test |
| 109 | + public void testDefaultInternalTag() { |
| 110 | + |
| 111 | + Consumer<String> test = s -> { |
| 112 | + Analyzer a = fromJson(s, Analyzer.class); |
| 113 | + assertEquals(Analyzer.Kind.Custom, a._kind()); |
| 114 | + assertEquals("some-filter", a.custom().filter().get(0)); |
| 115 | + assertTrue(a.custom().charFilter().isEmpty()); |
| 116 | + assertEquals("some-tokenizer", a.custom().tokenizer()); |
| 117 | + }; |
| 118 | + |
| 119 | + // Explicit type |
| 120 | + test.accept("{\"type\":\"custom\",\"filter\":[\"some-filter\"],\"tokenizer\":\"some-tokenizer\"}"); |
| 121 | + |
| 122 | + // Default type |
| 123 | + test.accept("{\"filter\":[\"some-filter\"],\"tokenizer\":\"some-tokenizer\"}"); |
| 124 | + } |
| 125 | + |
105 | 126 | @Test
|
106 | 127 | public void testBuilders() {
|
107 | 128 | String json = "{\"exists\":{\"field\":\"foo\"}}";
|
|
0 commit comments