|
| 1 | +setup: |
| 2 | + - skip: |
| 3 | + features: |
| 4 | + - headers |
| 5 | + - do: |
| 6 | + indices.create: |
| 7 | + index: test |
| 8 | + body: |
| 9 | + settings: |
| 10 | + number_of_replicas: 0 |
| 11 | + number_of_shards: 1 |
| 12 | + mappings: |
| 13 | + properties: |
| 14 | + id: |
| 15 | + type: integer |
| 16 | + body: |
| 17 | + type: match_only_text |
| 18 | + |
| 19 | + - do: |
| 20 | + bulk: |
| 21 | + index: test |
| 22 | + refresh: true |
| 23 | + body: |
| 24 | + - '{"index": {}}' |
| 25 | + - '{"id": 1, "body": "This is a match_only_text field 1"}' |
| 26 | + - '{"index": {}}' |
| 27 | + - '{"id": 2, "body": "This is a match_only_text field 2"}' |
| 28 | + |
| 29 | +--- |
| 30 | +teardown: |
| 31 | + - do: |
| 32 | + query.settings: |
| 33 | + body: |
| 34 | + transient: |
| 35 | + plugins.calcite.enabled : false |
| 36 | + plugins.calcite.fallback.allowed : true |
| 37 | + |
| 38 | +--- |
| 39 | +"Support match_only_text field type with Calcite enabled": |
| 40 | + - do: |
| 41 | + query.settings: |
| 42 | + body: |
| 43 | + transient: |
| 44 | + plugins.calcite.enabled : true |
| 45 | + plugins.calcite.fallback.allowed : false |
| 46 | + |
| 47 | + - do: |
| 48 | + headers: |
| 49 | + Content-Type: 'application/json' |
| 50 | + ppl: |
| 51 | + body: |
| 52 | + query: 'source=test | sort id | fields body | head 1' |
| 53 | + - match: {"total": 1} |
| 54 | + - match: {"schema": [{"name": "body", "type": "string"}]} |
| 55 | + - match: {"datarows": [["This is a match_only_text field 1"]]} |
| 56 | + |
| 57 | + - do: |
| 58 | + headers: |
| 59 | + Content-Type: 'application/json' |
| 60 | + ppl: |
| 61 | + body: |
| 62 | + query: "source=test | where like(body, '%field 2%') | fields body" |
| 63 | + - match: {"total": 1} |
| 64 | + - match: {"schema": [{"name": "body", "type": "string"}]} |
| 65 | + - match: {"datarows": [["This is a match_only_text field 2"]]} |
| 66 | + |
| 67 | +--- |
| 68 | +"Support match_only_text field type with Calcite disabled": |
| 69 | + - do: |
| 70 | + headers: |
| 71 | + Content-Type: 'application/json' |
| 72 | + ppl: |
| 73 | + body: |
| 74 | + query: 'source=test | sort id | fields body | head 1' |
| 75 | + - match: {"total": 1} |
| 76 | + - match: {"schema": [{"name": "body", "type": "string"}]} |
| 77 | + - match: {"datarows": [["This is a match_only_text field 1"]]} |
| 78 | + |
| 79 | + - do: |
| 80 | + headers: |
| 81 | + Content-Type: 'application/json' |
| 82 | + ppl: |
| 83 | + body: |
| 84 | + query: "source=test | where match_phrase(body, 'field 2') | fields body" |
| 85 | + - match: {"total": 1} |
| 86 | + - match: {"schema": [{"name": "body", "type": "string"}]} |
| 87 | + - match: {"datarows": [["This is a match_only_text field 2"]]} |
| 88 | + |
| 89 | +--- |
| 90 | +"Support match_only_text field type function push down with Calcite disabled": |
| 91 | + - do: |
| 92 | + headers: |
| 93 | + Content-Type: 'application/json' |
| 94 | + ppl.explain: |
| 95 | + body: |
| 96 | + query: "source=test | where match_phrase(body, 'field 2') | fields body" |
| 97 | + - match: { root.children.0.description.request: "OpenSearchQueryRequest(indexName=test, sourceBuilder={\"from\":0,\"size\":10000,\"timeout\":\"1m\",\"query\":{\"match_phrase\":{\"body\":{\"query\":\"field 2\",\"slop\":0,\"zero_terms_query\":\"NONE\",\"boost\":1.0}}},\"_source\":{\"includes\":[\"body\"],\"excludes\":[]},\"sort\":[{\"_doc\":{\"order\":\"asc\"}}]}, needClean=true, searchDone=false, pitId=null, cursorKeepAlive=null, searchAfter=null, searchResponse=null)"} |
| 98 | + |
| 99 | + |
| 100 | + - do: |
| 101 | + headers: |
| 102 | + Content-Type: 'application/json' |
| 103 | + ppl.explain: |
| 104 | + body: |
| 105 | + query: "source=test | where like(body, '%field 2%') | fields body" |
| 106 | + - match: { root.children.0.description.request: "OpenSearchQueryRequest(indexName=test, sourceBuilder={\"from\":0,\"size\":10000,\"timeout\":\"1m\",\"query\":{\"wildcard\":{\"body\":{\"wildcard\":\"*field 2*\",\"case_insensitive\":true,\"boost\":1.0}}},\"_source\":{\"includes\":[\"body\"],\"excludes\":[]},\"sort\":[{\"_doc\":{\"order\":\"asc\"}}]}, needClean=true, searchDone=false, pitId=null, cursorKeepAlive=null, searchAfter=null, searchResponse=null)"} |
0 commit comments