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

Indexed runtime field is executed at query time, instead of being read from disk. #119939

Open
philippkahr opened this issue Jan 10, 2025 · 1 comment
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch

Comments

@philippkahr
Copy link
Contributor

philippkahr commented Jan 10, 2025

fyi @herrBez

Elasticsearch Version

8.17.0 (probably all)

Installed Plugins

No response

Java Version

bundled

OS Version

ESS

Problem Description

Runtime field inside the mapping writes the value to disk. It is expected to read it from disk as well. However, in this case it is executed at query time, thus re-executing the script.

Steps to Reproduce

Run this:

PUT eventingested
{
  "mappings": {
    "properties": {
      "event": {
        "properties": {
          "ingested": {
        "type": "date",
        "on_script_error": "fail", 
        "script": {
          "source": """
            
        emit(new Date().getTime())
        """}
      }
        }
      }
    }
  }
}

POST eventingested/_doc?refresh=true
{
  "message": "ok"
}

GET eventingested/_search
{
  "fields": [
    "event.ingested"
  ]
}

And you get as event.ingested the query time and not the index time.

Logs (if relevant)

No response

@philippkahr philippkahr added >bug needs:triage Requires assignment of a team area label labels Jan 10, 2025
@javanna javanna added :Search Foundations/Mapping Index mappings, including merging and defining field types and removed needs:triage Requires assignment of a team area label labels Jan 10, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Jan 10, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@smalyshev smalyshev pinned this issue Jan 10, 2025
@smalyshev smalyshev unpinned this issue Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch
Projects
None yet
Development

No branches or pull requests

3 participants