-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Open
Labels
Description
The ml plugin defines a custom painless extension function domainSplit which splits a URL into the highest registered domain and subdomains. The function can be called via script_fields in a search but if called in runtime_mappings the script errors with:
Unknown call [domainSplit] with [[org.elasticsearch.painless.node.EDot@156a1756]] arguments
To Reproduce
PUT /domain-split-test
{
"mappings":{
"properties": {
"url": {
"type": "keyword"
}
}
}
}
POST /domain-split-test/_doc
{
"url":"www.elastic.co"
}
# OK with script fields
GET /domain-split-test/_search
{
"script_fields":{
"sub":{
"script":"return domainSplit(doc['url'].value).get(0)"
},
"hrd":{
"script":"return domainSplit(doc['url'].value).get(1);"
}
}
}
# Error using RT mappings
GET /domain-split-test/_search
{
"runtime_mappings":{
"sub":{
"type": "keyword",
"script":"emit(domainSplit(doc['url'].value).get(0))"
},
"hrd":{
"type": "keyword",
"script":"emit(domainSplit(doc['url'].value).get(1))"
}
}
}