-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Closed
Copy link
Labels
:Search Relevance/PercolatorReverse search: find queries that match a documentReverse search: find queries that match a document>bugTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearch
Description
Elasticsearch version 7.5.1
Plugins installed: []
JVM version 1.8.0_232
OS version Darwin C02XF3HBJHD2 18.7.0 Darwin Kernel Version 18.7.0: Sun Dec 1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64 x86_64
Sorting a percolate search by "_doc" results in range queries being incorrectly matched.
Note: this could be related to #52617
Steps to reproduce:
- Create an index
PUT /myindex
{
"mappings": {
"properties": {
"d": {
"type": "date"
},
"q": {
"type": "percolator"
}
}
}
}
- Index a couple of range queries that should be mutually exclisive
PUT /myindex/_doc/1
{
"q": {
"bool": {
"must": [
{
"range": {
"d": {
"gt": "now"
}
}
}
]
}
}
}
PUT /myindex/_doc/2
{
"q": {
"bool": {
"must": [
{
"range": {
"d": {
"lt": "now"
}
}
}
]
}
}
}
- Perform a percolate query sorted by "_doc"
GET /myindex/_search
{
"query": {
"percolate": {
"field": "q",
"document": {
"d": "2020-02-18T15:00:00.000+11:00"
}
}
},
"sort": [
"_doc"
]
}
Expected: Only one of the saved queries should match (document id "2").
Actual: Both of the saved queries match.
Note that you do get the correct behaviour if you do not sort the results. ie.
GET /myindex/_search
{
"query": {
"percolate": {
"field": "q",
"document": {
"d": "2020-02-18T15:05:00.000+11:00"
}
}
}
}
Metadata
Metadata
Assignees
Labels
:Search Relevance/PercolatorReverse search: find queries that match a documentReverse search: find queries that match a document>bugTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearch