-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Named queries should return their internal score as well
While some internal queries may not be scored or not contrbute to the final doc score, in some cases (such as knn queries compbined with other queries) the distance metric is very interesting and should be reported back as part of the response. This change adds that by default, so named queries always return the score (instead of just the name). It adds no additional cost. Signed-off-by: Itamar Syn-Hershko <[email protected]>
- Loading branch information
1 parent
5d5e8ad
commit e715622
Showing
11 changed files
with
189 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
rest-api-spec/src/main/resources/rest-api-spec/test/search/340_named_queries.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
"Named queries with score": | ||
- do: | ||
indices.create: | ||
index: test | ||
- do: | ||
index: | ||
index: test | ||
id: 1 | ||
body: { foo: bar } | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: 2 | ||
body: { foo: bar, foo2: bar2 } | ||
|
||
- do: | ||
indices.refresh: | ||
index: [test] | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
bool: { | ||
should: [ | ||
{ | ||
match: { | ||
foo: { | ||
query: bar, | ||
_name: foo_query, | ||
boost: 5 | ||
} | ||
} | ||
}, | ||
{ | ||
match: { | ||
foo2: { | ||
query: bar2, | ||
_name: foo2_query, | ||
boost: 20 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
|
||
- match: {hits.total.value: 2} | ||
- length: {hits.hits.0.matched_queries: 2} | ||
- gt: {hits.hits.0.matched_queries.foo_query: 0.0} | ||
- gt: {hits.hits.0.matched_queries.foo2_query: 0.0} | ||
- length: {hits.hits.1.matched_queries: 1 } | ||
- gt: {hits.hits.1.matched_queries.foo_query: 0.0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.