From deeb3eebacb4eb31858a7439db18e64521e4c4b7 Mon Sep 17 00:00:00 2001 From: bowenlan-amzn Date: Fri, 19 Jul 2024 21:24:16 -0700 Subject: [PATCH] example yaml test Signed-off-by: bowenlan-amzn --- .../test/search/175_terms_lookup.yml | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 rest-api-spec/src/main/resources/rest-api-spec/test/search/175_terms_lookup.yml diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search/175_terms_lookup.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search/175_terms_lookup.yml new file mode 100644 index 0000000000000..9201835acac6f --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search/175_terms_lookup.yml @@ -0,0 +1,67 @@ +--- +"Terms lookup on a bitmap field": + - do: + indices.create: + index: students + body: + settings: + number_of_shards: 1 + number_of_replicas: 0 + mappings: + properties: + student_id: + type: integer + - do: + bulk: + refresh: true + body: + - { "index": { "_index": "students", "_id": "1" } } + - { "name": "Jane Doe", "student_id": 111 } + - { "index": { "_index": "students", "_id": "2" } } + - { "name": "Mary Major", "student_id": 222 } + - { "index": { "_index": "students", "_id": "3" } } + - { "name": "John Doe", "student_id": 333 } + - do: + indices.create: + index: classes + body: + settings: + number_of_shards: 1 + number_of_replicas: 0 + mappings: + properties: + enrolled: + type: binary + store: true + - do: + index: + index: classes + id: 101 + body: { "enrolled" : "OjAAAAEAAAAAAAEAEAAAAG8A3gA=" } + + - do: + cluster.health: + wait_for_status: green + + - do: + search: + rest_total_hits_as_int: true + index: students + body: { + "query": { + "terms": { + "student_id": { + "index": "classes", + "id": "101", + "path": "enrolled", + "store": true + }, + "value_type": "bitmap" + } + } + } + - match: { hits.total: 2 } + - match: { hits.hits.0._source.name: Jane Doe } + - match: { hits.hits.0._source.student_id: 111 } + - match: { hits.hits.1._source.name: Mary Major } + - match: { hits.hits.1._source.student_id: 222 }