Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ class org.elasticsearch.script.field.DelegateDocValuesField @dynamic_type {
class org.elasticsearch.script.field.BinaryDocValuesField @dynamic_type {
ByteBuffer get(ByteBuffer)
ByteBuffer get(int, ByteBuffer)
}
}

class org.elasticsearch.script.field.BooleanDocValuesField @dynamic_type {
boolean get(boolean)
boolean get(int, boolean)
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ setup:
scaled_float: 3.14
token_count: count all these words please

- do:
index:
index: test
id: 2
body: {}

- do:
index:
index: test
id: 3
body:
boolean: [true, false, true]

- do:
indices.refresh: {}

Expand All @@ -67,6 +80,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -77,12 +91,92 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
source: "doc['boolean'].value"
- match: { hits.hits.0.fields.field.0: true }

- do:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
source: "field('boolean').get(false)"
- match: { hits.hits.0.fields.field.0: true }

- do:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:

field:
script:
source: "field('boolean').get(false)"
- match: { hits.hits.0.fields.field.0: true }

- do:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 2 } }
script_fields:
field:
script:
source: "field('boolean').get(false)"
- match: { hits.hits.0.fields.field.0: false }

- do:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
source: "field('boolean').get(1, false)"
- match: { hits.hits.0.fields.field.0: false }

- do:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
source: "int total = 0; for (boolean b : field('boolean')) { total += b ? 1 : 0; } total;"
- match: { hits.hits.0.fields.field.0: 1 }

- do:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 3 } }
script_fields:
field:
script:
source: "int total = 0; for (boolean b : field('boolean')) { total += b ? 1 : 0; } total + field('boolean').size();"
- match: { hits.hits.0.fields.field.0: 5 }

- do:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 2 } }
script_fields:
field:
script:
source: "field('boolean').size()"
- match: { hits.hits.0.fields.field.0: 0 }


---
"date":
- skip:
Expand All @@ -92,6 +186,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -102,6 +197,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -114,6 +210,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -125,6 +222,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -136,6 +234,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
centroid:
script:
Expand All @@ -147,6 +246,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
bbox:
script:
Expand All @@ -160,6 +260,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
topLeft:
script:
Expand All @@ -176,6 +277,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
type:
script:
Expand All @@ -186,6 +288,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
width:
script:
Expand All @@ -202,6 +305,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -212,6 +316,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -224,6 +329,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -234,6 +340,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -249,6 +356,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -259,6 +367,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -271,6 +380,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -281,6 +391,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -293,6 +404,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -303,6 +415,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -315,6 +428,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -325,6 +439,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -337,6 +452,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -347,6 +463,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -359,6 +476,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -369,6 +487,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -381,6 +500,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -391,6 +511,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -403,6 +524,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -413,6 +535,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -425,6 +548,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand All @@ -435,6 +559,7 @@ setup:
search:
rest_total_hits_as_int: true
body:
query: { term: { _id: 1 } }
script_fields:
field:
script:
Expand Down
Loading