Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return matched_queries for named queries in percolator #10163

Closed
0xgeert opened this issue Mar 19, 2015 · 9 comments · Fixed by #103084
Closed

Return matched_queries for named queries in percolator #10163

0xgeert opened this issue Mar 19, 2015 · 9 comments · Fixed by #103084
Assignees
Labels
>enhancement :Search/Percolator Reverse search: find queries that match a document Team:Search Meta label for search team

Comments

@0xgeert
Copy link

0xgeert commented Mar 19, 2015

I've got a bunch of multi-match percolator queries, which are named queries as well. It would be great to be able to get a response of matched queries including matched_queries when percolating. e.g.:

  {
     "took": 0,
     "_shards": {
        "total": 5,
        "successful": 5,
        "failed": 0
     },
     "total": 2,
     "matches": [
        {
           "_index": "rethinkdb_ex",
           "_id": "user-1",
           "matched_queries": [
              "queryA"
           ]
        },
        {
           "_index": "rethinkdb_ex",
           "_id": "user-2",
           "matched_queries": [
              "queryA",
              "queryB"
           ]
        }
     ]
  }

Is this something that's planned?

@0xgeert 0xgeert changed the title return matched_queries for named queries in percolator Return matched_queries for named queries in percolator Mar 19, 2015
@javanna
Copy link
Member

javanna commented Mar 19, 2015

Hi @gebrits why no storing them as different queries in the percolator index? Can you elaborate on the usecase?

@javanna javanna added :Search/Percolator Reverse search: find queries that match a document discuss labels Mar 19, 2015
@0xgeert
Copy link
Author

0xgeert commented Mar 19, 2015

hi @javanna, Each multi-match query is bound to a single user for notification purposes (e.g.: sending out a mail). If I were to split out the multi-match in various queries, my notification client code would get a a bit more complicated. I.e.: having to track the results of all queries matching the same user, wrapping up the results, constructing a mail based on the aggregate results, deduping, etc.

It just feels cleaner to have it all handled by 1 multi-match query. What do you think?

@javanna
Copy link
Member

javanna commented Mar 20, 2015

I am on the fence to be honest :) I always imagined this usecase with multiple alerts/queries per user and assumed that indeed the different matching queries would need to be aggregated on the client side. It feels cleaner this way to me, but I don't have a super strong opinion. I marked this for discussion, we'll see what other folks think about it. Thanks for describing your usecase!

@javanna javanna assigned javanna and unassigned javanna Mar 20, 2015
@0xgeert
Copy link
Author

0xgeert commented Mar 24, 2015

No probs :) To fuel the discussion, I feel the need for clientside de-duping is the 'biggest' hurdle that would be solved with this. It's just messy. (e.g.: taking care of ordening, etc.)

@jpountz
Copy link
Contributor

jpountz commented Sep 27, 2015

The trade-off between the cost of this feature (both in terms of dev cost and runtime) and the value it provides doesn't look good to me: closing.

@jpountz jpountz closed this as completed Sep 27, 2015
@sdjw
Copy link

sdjw commented Oct 5, 2018

Was this ever re-addressed? My use case involves complex boolean queries that, if expanded into all individual queries, would increase the number of percolator queries very dramatically, exponentially actually. It would vastly complicate things in my app to do that. Whereas if elasticsearch could just tell me which parts of the query it matched on, like it does with named queries, that information would be incredibly valuable. If it was optional, I would gladly pay the performance cost.

@Cusden
Copy link

Cusden commented Mar 17, 2020

I'd like for it to be readressed, as well.
ES has improved tremendously over the years, and what could have been a huge performance wall then might not be now.
Our users are saving very complex queries, with lots of boolean queries. We can't possibly ask them to create one query per possible combination.
If it's optional, the performance of the many who wouldn't need this wouldn't be impacted.

@romseygeek
Copy link
Contributor

We're re-opening this, as the low-level lucene Matches API should make this considerably easier to implement. We don't have any plans to work on it currently, but we're happy to help if anybody from the community wants to pick it up.

@romseygeek romseygeek reopened this Mar 18, 2020
@romseygeek romseygeek added the help wanted adoptme label Mar 18, 2020
@rjernst rjernst added the Team:Search Meta label for search team label May 4, 2020
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@mayya-sharipova mayya-sharipova self-assigned this Dec 1, 2023
@mayya-sharipova mayya-sharipova removed the help wanted adoptme label Dec 1, 2023
mayya-sharipova added a commit to mayya-sharipova/elasticsearch that referenced this issue Dec 6, 2023
Return matched_queries for named queries in Percolator.
This shows which particular sub-queries of a percolator query were matches
for percolated documents

Closes elastic#10163
mayya-sharipova added a commit to mayya-sharipova/elasticsearch that referenced this issue Dec 6, 2023
Return matched_queries for named queries in Percolator.

In a response, each hit together with
a `_percolator_document_slot` field will contain
`_percolator_document_slot_<slotNumber>_matched_queries` fields that will show
which sub-queries matched each percolated document.

Closes elastic#10163
mayya-sharipova added a commit that referenced this issue Dec 11, 2023
Return matched_queries for named queries in Percolator.

In a response, each hit together with
a `_percolator_document_slot` field will contain
`_percolator_document_slot_<slotNumber>_matched_queries` fields that will show
which sub-queries matched each percolated document.

Closes #10163
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Percolator Reverse search: find queries that match a document Team:Search Meta label for search team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants