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

Ability to perform Nested Sort Like filtering #51818

Open
f3l1xss opened this issue Feb 3, 2020 · 7 comments
Open

Ability to perform Nested Sort Like filtering #51818

f3l1xss opened this issue Feb 3, 2020 · 7 comments
Labels
>enhancement :Search Relevance/Search Catch all for Search Relevance Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch

Comments

@f3l1xss
Copy link

f3l1xss commented Feb 3, 2020

Currently we have nested sort functionality where we are able to specify filter logic, path, sortMode (min, max, sum, avg, median).

https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-request-sort.html#nested-sorting

It would be wonderful if there can be similar functionality for filtering where we can specify above parameters + boolean expression to evaluate whether the doc is valid.

For Example given mapping below:

cargroup

 "mappings": {
    "properties": {
      "id":     { "type": "integer" },
      "cars":   { "type": "nested",
                            "properties": {
                                    "brand": {
                                        "type": "keyword"
                                    },
                                    "value": {
                                        "type": "integer"
                                    }
                                }
                        },

and documents:

[id: 1,
cars:[{
brand: toyota,
value: 30},
{
brand: toyota,
value: 30},
{
brand: honda,
value: 30}
],
id: 2,
cars:[{
brand: toyota,
value: 30},
{
brand: toyota,
value: 50},
{
brand: honda,
value: 30}
],
id: 3,
cars:[{
brand: toyota,
value: 30},
{
brand: toyota,
value: 80},
{
brand: honda,
value: 30}
]]

I could easily search for doc which has Sum of Toyota value greater than 100 by setting filter logic as 'term: brand= toyota', path: cars, filterMode: sum, boolean expression: totalSum > 100

Theoretically, we can achieve the same thing using script query. However, I realized that in filter context
https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-filter-context.html

_source is not available, only doc values which prohibit us from accessing nested fields.

@dliappis dliappis added the :Search/Search Search-related issues that do not fall into other categories label Feb 3, 2020
@elasticmachine
Copy link
Collaborator

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

@jimczi jimczi added the >feature label Feb 3, 2020
@f3l1xss
Copy link
Author

f3l1xss commented Feb 17, 2020

Hi, anybody looking into this?

@f3l1xss
Copy link
Author

f3l1xss commented Apr 24, 2020

Hello what do you guys think about this? @jimczi @dliappis

@rjernst rjernst added the Team:Search Meta label for search team label May 4, 2020
@tigra-sms
Copy link

Is there any update on this issue? It would be great to have this functionality enabled. It used to work in v5.6, nested objects could be accessed via _source variable in a filter, but updating to v7 it stopped working and seems there's no way to have this done now.

@f3l1xss
Copy link
Author

f3l1xss commented Aug 17, 2020

@MarinaRNext I have been waiting for 6 mths and there has been no response at all. So strange as this functionality seem pretty basic to me

@f3l1xss f3l1xss closed this as completed Aug 18, 2020
@f3l1xss f3l1xss reopened this Aug 18, 2020
@elasticsearchmachine
Copy link
Collaborator

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

@javanna javanna added :Search Relevance/Search Catch all for Search Relevance and removed :Search/Search Search-related issues that do not fall into other categories labels Jul 17, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Jul 17, 2024
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine removed the Team:Search Meta label for search team label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search Relevance/Search Catch all for Search Relevance Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch
Projects
None yet
Development

No branches or pull requests

8 participants