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

unsigned_long field type doesn't work with function_score decay functions #89603

Closed
mayya-sharipova opened this issue Aug 24, 2022 · 1 comment · Fixed by #96394
Closed

unsigned_long field type doesn't work with function_score decay functions #89603

mayya-sharipova opened this issue Aug 24, 2022 · 1 comment · Fixed by #96394
Assignees
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team

Comments

@mayya-sharipova
Copy link
Contributor

Elasticsearch Version

8.4

Installed Plugins

No response

Java Version

bundled

OS Version

any

Problem Description

unsigned_long field type doesn't work with function_score decay functions, and produces an error:

"type" : "parsing_exception",
"reason" : "field [unsigned_long_test] is of type [org.elasticsearch.xpack.unsignedlong.UnsignedLongFieldMapper$UnsignedLongFieldType@10281e68], but only numeric types are supported."

Steps to Reproduce

1. Create index

PUT numeric-test-mapping
{
  "mappings": {
    "properties": {
      "double_test": {
        "type": "double"
      },
      "unsigned_long_test": {
        "type": "unsigned_long"
      },
      "long_test": {
        "type": "long"
      }
    }
  }
}

2. Create documents with numeric values for the 3 different fields

POST numeric-test-mapping/_doc/
{
  "double_test": 10, 
  "unsigned_long_test": 10,
  "long_test": 10
}
POST numeric-test-mapping/_doc/
{
  "double_test": 11, 
  "unsigned_long_test": 11,
  "long_test": 11
}

POST numeric-test-mapping/_doc/
{
  "double_test": 12, 
  "unsigned_long_test": 12,
  "long_test": 12
}

3. Run search on index created

GET numeric-test-mapping/_search 
{
  "from": 0,
  "size": 10,
  "query": {
    "function_score": {
    "functions": [
        {
            "gauss":{
                "unsigned_long_test":{
                  "scale": 1,
                  "origin": 0
                }
            }
        }]
    }
  }
}

Logs (if relevant)

No response

@mayya-sharipova mayya-sharipova added >bug :Search/Search Search-related issues that do not fall into other categories labels Aug 24, 2022
@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label Aug 24, 2022
@elasticsearchmachine
Copy link
Collaborator

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

@jdconrad jdconrad self-assigned this May 12, 2023
jdconrad added a commit that referenced this issue May 30, 2023
This change adds support for unsigned long fields (and any fields that can provide numeric data) to 
use decay functions as described by (#89603). This allows mapped fields developed as plugins to also 
have access to this set of functions provided they return IndexNumericFieldData from getForField.

Closes #89603.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants