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

Sorting mixing "float" and "double" types doesn't work #78699

Open
Tracked by #114353
cbuescher opened this issue Oct 5, 2021 · 7 comments
Open
Tracked by #114353

Sorting mixing "float" and "double" types doesn't work #78699

cbuescher opened this issue Oct 5, 2021 · 7 comments
Labels
>enhancement :Search Relevance/Search Catch all for Search Relevance Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.0.0

Comments

@cbuescher
Copy link
Member

Searching across multiple indices and sorting on a field that has a "double" type in one and a "float" type in other indices doesn't currently work:

Example script

DELETE test*

PUT test1
{
  "mappings": {
    "properties": {
      "f1" : {
        "type": "double"
      }
    }
  }
}

PUT test2
{
  "mappings": {
    "properties": {
      "f1" : {
        "type": "float"
      }
    }
  }
}

PUT /_bulk
{ "index" : { "_index" : "test1", "_id" : "1" } }
{ "f1" : "1.0" }
{ "index" : { "_index" : "test2", "_id" : "2" } }
{ "f1" : "2.0" }

POST /test1,test2/_search
{
  "sort" : [ "f1"]
}

This returns and exception with the following cause

"caused_by" : {
      "type" : "class_cast_exception",
      "reason" : "class java.lang.Double cannot be cast to class java.lang.Float (java.lang.Double and java.lang.Float are in module java.base of loader 'bootstrap')"
    }

I don't think we ever supported mixing these two types, at least on 6.8. the same error behaviour can be observed. However, mixing different numeric types of the short/integer/long family does word since we internally use the same SortField.Type for their NumericType, but for some reason the ones for "float" and "double" are different.
Opening this issue to investigate whether this isn't possible for a good reason, simply technically infeasibel or if we can indeed add support for it.

@cbuescher cbuescher added >enhancement :Search/Search Search-related issues that do not fall into other categories v8.0.0 v7.16.0 labels Oct 5, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Oct 5, 2021
@elasticmachine
Copy link
Collaborator

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

@cbuescher cbuescher self-assigned this Oct 5, 2021
@rahulreddyv
Copy link

@cbuescher is it okay if I pick this up? I want to contribute to ES, this seems to be a good starting point :)

@cbuescher
Copy link
Member Author

is it okay if I pick this up

I think we first need to make sure we want to enable this. As I mentioned in the description, I'm not entirely sure if this doesn't work on purpose or if there are technical reasons that make this difficult to accomplish. Please take a look if you like but don't be disappointed if this moves into a different direction.

@rahulreddyv
Copy link

is it okay if I pick this up

I think we first need to make sure we want to enable this. As I mentioned in the description, I'm not entirely sure if this doesn't work on purpose or if there are technical reasons that make this difficult to accomplish. Please take a look if you like but don't be disappointed if this moves into a different direction.

Sure. Thanks for responding.

@danhermann danhermann added v8.1.0 and removed v7.16.0 labels Oct 27, 2021
@nephel
Copy link

nephel commented Nov 5, 2021

I think this is relevant? #38095

@jimczi
Copy link
Contributor

jimczi commented Nov 9, 2021

I think we should handle mixing floating points transparently. It works for longs mixed with integers so I don't see why we wouldn't do the same for floats.

@rjernst rjernst added v8.8.0 and removed v8.7.0 labels Feb 8, 2023
@gmarouli gmarouli added v8.9.0 and removed v8.8.0 labels Apr 26, 2023
@quux00 quux00 added v8.11.0 and removed v8.10.0 labels Aug 16, 2023
@mattc58 mattc58 added v8.12.0 and removed v8.11.0 labels Oct 4, 2023
@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 v9.0.0
Projects
None yet
Development

No branches or pull requests