Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Chaitanya Gohel <[email protected]>
  • Loading branch information
gashutos committed Oct 31, 2023
1 parent 1ce776a commit 9cce0f6
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@
counter:
type: double

- do:
indices.create:
index: test_3
body:
mappings:
properties:
counter:
type: half_float

- do:
bulk:
refresh: true
Expand All @@ -43,21 +34,15 @@
- index:
_index: test_2
- counter: 184.4
- index:
_index: test_3
- counter: 187.4
- index:
_index: test_3
- counter: 194.4

- do:
search:
index: test_*
rest_total_hits_as_int: true
body:
sort: [{ counter: desc }]
- match: { hits.total: 5 }
- length: { hits.hits: 5 }
- match: { hits.total: 3 }
- length: { hits.hits: 3 }
- match: { hits.hits.0._index: test_2 }
- match: { hits.hits.0._source.counter: 1223372036854775800.23 }
- match: { hits.hits.0.sort.0: 1223372036854775800.23 }
Expand All @@ -71,13 +56,14 @@
rest_total_hits_as_int: true
body:
sort: [{ counter: asc }]
- match: { hits.total: 5 }
- length: { hits.hits: 5 }
- match: { hits.total: 3 }
- length: { hits.hits: 3 }
- match: { hits.hits.0._index: test_2 }
- match: { hits.hits.0._source.counter: 184.4 }
- match: { hits.hits.0.sort.0: 184.4 }
- match: { hits.hits.1._index: test_3 }
- match: { hits.hits.1._source.counter: 187.4 }
- match: { hits.hits.1._index: test_1 }
- match: { hits.hits.1._source.counter: 223372036854775800 }
- match: { hits.hits.1.sort.0: 223372036854775800 }

---
"search across indices with mixed long, double and unsigned_long numeric types":
Expand Down Expand Up @@ -134,3 +120,85 @@
- match: { status: 400 }
- match: { error.type: search_phase_execution_exception }
- match: { error.caused_by.reason: "Can't do sort across indices, as a field has [unsigned_long] type in one index, and different type in another index!" }

---
"search across indices with mixed long and double and float numeric types":
- skip:
version: " - 2.10.99"
reason: half float was broken before 2.11

- do:
indices.create:
index: test_1
body:
mappings:
properties:
counter:
type: long

- do:
indices.create:
index: test_2
body:
mappings:
properties:
counter:
type: double

- do:
indices.create:
index: test_3
body:
mappings:
properties:
counter:
type: half_float

- do:
bulk:
refresh: true
body:
- index:
_index: test_1
- counter: 223372036854775800
- index:
_index: test_2
- counter: 1223372036854775800.23
- index:
_index: test_2
- counter: 184.4
- index:
_index: test_3
- counter: 187.4
- index:
_index: test_3
- counter: 194.4

- do:
search:
index: test_*
rest_total_hits_as_int: true
body:
sort: [{ counter: desc }]
- match: { hits.total: 5 }
- length: { hits.hits: 5 }
- match: { hits.hits.0._index: test_2 }
- match: { hits.hits.0._source.counter: 1223372036854775800.23 }
- match: { hits.hits.0.sort.0: 1223372036854775800.23 }
- match: { hits.hits.1._index: test_1 }
- match: { hits.hits.1._source.counter: 223372036854775800 }
- match: { hits.hits.1.sort.0: 223372036854775800 }

- do:
search:
index: test_*
rest_total_hits_as_int: true
body:
sort: [{ counter: asc }]
- match: { hits.total: 5 }
- length: { hits.hits: 5 }
- match: { hits.hits.0._index: test_2 }
- match: { hits.hits.0._source.counter: 184.4 }
- match: { hits.hits.0.sort.0: 184.4 }
- match: { hits.hits.1._index: test_3 }
- match: { hits.hits.1._source.counter: 187.4 }
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@

---
"half float":
- skip:
version: " - 2.10.99"
reason: half_float was broken for 2.10 and earlier

- do:
indices.create:
index: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.io.IOException;

/**
* The comparator for unsigned long numeric type.
* The comparator for unsigned half_float numeric type.
* Comparator based on {@link Float#compare} for {@code numHits}. This comparator provides a
* skipping functionality – an iterator that can skip over non-competitive documents.
*/
Expand Down

0 comments on commit 9cce0f6

Please sign in to comment.