|
@@ -70,6 +70,11 @@ setup:
|
|
|
type: scaled_float
|
|
|
scaling_factor: 100
|
|
|
doc_values: false
|
|
|
+ text:
|
|
|
+ type: text
|
|
|
+ fielddata: true
|
|
|
+ text_no_field_data:
|
|
|
+ type: text
|
|
|
token_count:
|
|
|
type: token_count
|
|
|
analyzer: standard
|
|
@@ -110,6 +115,8 @@ setup:
|
|
|
half_float_no_doc_values: 3.140625
|
|
|
scaled_float: 3.14
|
|
|
scaled_float_no_doc_values: 3.14
|
|
|
+ text: "Lots of text."
|
|
|
+ text_no_field_data: "Lots of text."
|
|
|
token_count: count all these words please
|
|
|
|
|
|
- do:
|
|
@@ -150,6 +157,8 @@ setup:
|
|
|
half_float_no_doc_values: [2.234, 1.123]
|
|
|
scaled_float: [-3.5, 2.5]
|
|
|
scaled_float_no_doc_values: [2.5, -3.5]
|
|
|
+ text: ["Lots of text.", "even more text", "SOOOOO much text"]
|
|
|
+ text_no_field_data: ["Lots of text.", "even more text", "SOOOOO much text"]
|
|
|
|
|
|
|
|
|
- do:
|
|
@@ -2719,6 +2728,264 @@ setup:
|
|
|
source: "int value = field('dne').get(1, 1); value"
|
|
|
- match: { hits.hits.0.fields.field.0: 1 }
|
|
|
|
|
|
+---
|
|
|
+"text":
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ query: { term: { _id: "1" } }
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "doc['text'].get(0)"
|
|
|
+ - match: { hits.hits.0.fields.field.0: lots }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ query: { term: { _id: "1" } }
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "doc['text'].value"
|
|
|
+ - match: { hits.hits.0.fields.field.0: lots }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "field('text').get('')"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "Lots of text." }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "Lots of text." }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "/* avoid yaml stash */ $('text', '')"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "Lots of text." }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "Lots of text." }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "String defaultText = 'default text'; field('text').get(defaultText)"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "Lots of text." }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "default text" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "Lots of text." }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "String defaultText = 'default text'; $('text', defaultText)"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "Lots of text." }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "default text" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "Lots of text." }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "field('text').get(1, '')"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "SOOOOO much text" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "String defaultText = 'default text'; field('text').get(1, defaultText)"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "default text" }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "default text" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "SOOOOO much text" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "field('text').get(1, '')"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "SOOOOO much text" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "String cat = ''; for (String s : field('text')) { cat += s; } cat + field('text').size();"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "Lots of text.1" }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "0" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "Lots of text.SOOOOO much texteven more text3" }
|
|
|
+
|
|
|
+---
|
|
|
+"text_no_field_data":
|
|
|
+ - do:
|
|
|
+ catch: bad_request
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ query: { term: { _id: "1" } }
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "doc['text_no_field_data'].get(0)"
|
|
|
+ - match: { error.failed_shards.0.reason.caused_by.type: "illegal_argument_exception" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ catch: bad_request
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ query: { term: { _id: "1" } }
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "doc['text_no_field_data'].value"
|
|
|
+ - match: { error.failed_shards.0.reason.caused_by.type: "illegal_argument_exception" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "field('text_no_field_data').get('')"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "Lots of text." }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "Lots of text." }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "/* avoid yaml stash */ $('text_no_field_data', '')"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "Lots of text." }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "Lots of text." }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "String defaultText = 'default text'; field('text_no_field_data').get(defaultText)"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "Lots of text." }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "default text" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "Lots of text." }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "String defaultText = 'default text'; $('text_no_field_data', defaultText)"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "Lots of text." }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "default text" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "Lots of text." }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "field('text_no_field_data').get(1, '')"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "SOOOOO much text" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "String defaultText = 'default text'; field('text_no_field_data').get(1, defaultText)"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "default text" }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "default text" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "SOOOOO much text" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "field('text_no_field_data').get(1, '')"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "SOOOOO much text" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ rest_total_hits_as_int: true
|
|
|
+ body:
|
|
|
+ sort: [ { rank: asc } ]
|
|
|
+ script_fields:
|
|
|
+ field:
|
|
|
+ script:
|
|
|
+ source: "String cat = ''; for (String s : field('text_no_field_data')) { cat += s; } cat + field('text_no_field_data').size();"
|
|
|
+ - match: { hits.hits.0.fields.field.0: "Lots of text.1" }
|
|
|
+ - match: { hits.hits.1.fields.field.0: "0" }
|
|
|
+ - match: { hits.hits.2.fields.field.0: "Lots of text.SOOOOO much texteven more text3" }
|
|
|
+
|
|
|
---
|
|
|
"version and sequence number":
|
|
|
- do:
|