Skip to content

Commit

Permalink
updating test to add more than one inner_hits
Browse files Browse the repository at this point in the history
  • Loading branch information
pmpailis committed Nov 8, 2024
1 parent 8a05ff4 commit c120f89
Showing 1 changed file with 53 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ setup:
properties:
data:
type: keyword
paragraph_id:
type: dense_vector
dims: 1
index: true
similarity: l2_norm

- do:
index:
Expand Down Expand Up @@ -131,6 +136,15 @@ setup:
keyword: "technology"
nested: { views: 10}
nested_inner_hits: [{"data": "foo"}, {"data": "bar"}, {"data": "baz"}]

- do:
index:
index: test
id: "10"
body:
id: 10
integer: 3
nested_inner_hits: [ {"data": "foo", "paragraph_id": [1]}]
- do:
indices.refresh: {}

Expand Down Expand Up @@ -979,11 +993,13 @@ setup:
rrf:
retrievers: [
{
# this will return doc 9 and doc 10
standard: {
query: {
nested: {
path: nested_inner_hits,
inner_hits: {
name: nested_data_field,
_source: false,
"sort": [ {
"nested_inner_hits.data": "asc"
Expand All @@ -998,6 +1014,29 @@ setup:
}
}
},
{
# this will return doc 10
standard: {
query: {
nested: {
path: nested_inner_hits,
inner_hits: {
name: nested_vector_field,
_source: false,
size: 1,
"fields": [ "nested_inner_hits.paragraph_id" ]
},
query: {
knn: {
field: nested_inner_hits.paragraph_id,
query_vector: [ 1 ],
num_candidates: 10
}
}
}
}
}
},
{
standard: {
query: {
Expand All @@ -1008,13 +1047,20 @@ setup:
]
rank_window_size: 10
rank_constant: 10
size: 2
size: 3

- match: { hits.total.value: 10 }

- match: { hits.total.value: 9 }
- match: { hits.hits.0.inner_hits.nested_data_field.hits.total.value: 1 }
- match: { hits.hits.0.inner_hits.nested_data_field.hits.hits.0.fields.nested_inner_hits.0.data.0: foo }
- match: { hits.hits.0.inner_hits.nested_vector_field.hits.total.value: 1 }
- match: { hits.hits.0.inner_hits.nested_vector_field.hits.hits.0.fields.nested_inner_hits.0.paragraph_id: [ 1 ] }

- match: { hits.hits.0.inner_hits.nested_inner_hits.hits.total.value: 3 }
- match: { hits.hits.0.inner_hits.nested_inner_hits.hits.hits.0.fields.nested_inner_hits.0.data.0: bar }
- match: { hits.hits.0.inner_hits.nested_inner_hits.hits.hits.1.fields.nested_inner_hits.0.data.0: baz }
- match: { hits.hits.0.inner_hits.nested_inner_hits.hits.hits.2.fields.nested_inner_hits.0.data.0: foo }
- match: { hits.hits.1.inner_hits.nested_data_field.hits.total.value: 3 }
- match: { hits.hits.1.inner_hits.nested_data_field.hits.hits.0.fields.nested_inner_hits.0.data.0: bar }
- match: { hits.hits.1.inner_hits.nested_data_field.hits.hits.1.fields.nested_inner_hits.0.data.0: baz }
- match: { hits.hits.1.inner_hits.nested_data_field.hits.hits.2.fields.nested_inner_hits.0.data.0: foo }
- match: { hits.hits.1.inner_hits.nested_vector_field.hits.total.value: 0 }

- match: { hits.hits.1.inner_hits.nested_inner_hits.hits.total.value: 0 }
- match: { hits.hits.2.inner_hits.nested_data_field.hits.total.value: 0 }
- match: { hits.hits.2.inner_hits.nested_vector_field.hits.total.value: 0 }

0 comments on commit c120f89

Please sign in to comment.