i didn't interstand , i add a scripted field in index and i didn' change anything;
type : number
format: default
Popularity : 0
i add the script and when i clic in button create field
Blockquote
Script is invalid. View script preview for details
Access fields with doc['some_field'].value .
Get help with the syntax and preview the results of your script.
"Get help with the syntax and preview the results of your script" is a link. If you click it, it will open a flyout with two tabs (Syntax and "Preview results"). Click "Preview results" and an error message should be shown.
okay, first i want to thank you because when i try the script again it works, then just i want to know please when i change the field with code (type ; string)
Blockquote
.......
org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:98)",
"org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:41)",
"if( doc['code'].value == '1' ){\r\n \r\n ",
" ^---- HERE"
],
"script": "if( doc['code'].value == '1' ){\r\n \r\n return 10 ;\r\n \r\n } else if (doc['code'].value == '2') {\r\n \r\n return 50;\r\n \r\n }",
"lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [code] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."
}
}
}
]
}
Fielddata is disabled on text fields by default. Set fielddata=true on [code] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead
If you are using the default mapping for your index, code.keyword instead of code should fix the problem.
Hi, please can you tell me what does it mean this error ?
Blockquote
failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"test","node":"LHk548iBS6u1OZMSNqZDMg","reason":{"type":"aggregation_execution_exception","reason":"Unsupported script value , expected a number, date, or boolean"}}]},"status":500}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.