elasticsearch-painless

Elasticsearch Painless calculate score from nested elements

偶尔善良 提交于 2019-12-04 07:35:45
Note: I had originally posted this question a little differently and it wasn't worth updating as after reading I learned a bit more. Requirement Search for documents and calculate a custom score based on nested elements within the document. Structure { "mappings": { "book": { "properties": { "title": { "type": "string", "index": "not_analyzed" }, "topics": { "type": "nested", "properties": { "title": { "type": "string", "index": "not_analyzed" }, "weight": { "type": "int" } } } } } } } Sample Query { "query": { "function_score": { "query": { "term": { "title": "The Magical World of Spittle" }

Painless scripted field match

…衆ロ難τιáo~ 提交于 2019-12-02 17:52:42
问题 I'm struggling with Scripted Fields in Kibana. I have created dataframe which contains data grouped by num1: timestamp num1 suffix Jul 23, 2019 @ 11:24:18.000 1563866656871111 dn Jul 23, 2019 @ 11:24:18.000 1563866656872222 dn Jul 23, 2019 @ 11:24:18.000 1563866656876839 dn Sep 4, 2019 @ 15:24:18.000 1563866656878888 dn Jul 26, 2019 @ 19:44:18.000 1563867854323333 dn Jul 26, 2019 @ 19:44:18.000 1563867854324841 dn Jul 4, 2019 @ 15:56:17.000 1562241377271986 mt Jul 4, 2019 @ 15:56:17.000

Painless scripted field match

柔情痞子 提交于 2019-12-02 12:00:01
I'm struggling with Scripted Fields in Kibana. I have created dataframe which contains data grouped by num1: timestamp num1 suffix Jul 23, 2019 @ 11:24:18.000 1563866656871111 dn Jul 23, 2019 @ 11:24:18.000 1563866656872222 dn Jul 23, 2019 @ 11:24:18.000 1563866656876839 dn Sep 4, 2019 @ 15:24:18.000 1563866656878888 dn Jul 26, 2019 @ 19:44:18.000 1563867854323333 dn Jul 26, 2019 @ 19:44:18.000 1563867854324841 dn Jul 4, 2019 @ 15:56:17.000 1562241377271986 mt Jul 4, 2019 @ 15:56:17.000 1562241377327366 mt Jul 4, 2019 @ 15:56:17.000 1562241377361430 mt Jul 4, 2019 @ 15:56:17.000

elasticsearch-painless - Manipulate date

时光怂恿深爱的人放手 提交于 2019-11-28 08:13:00
问题 I am trying to manipulate date in elasticsearch's scripting language painless . Specifically, I am trying to add 4 hours, which is 14,400 seconds. { "script_fields": { "new_date_field": { "script": { "inline": "doc['date_field'] + 14400" } } } } This throws Cannot apply [+] operation to types [org.elasticsearch.index.fielddata.ScriptDocValues.Longs] and [java.lang.Integer]. Thanks 回答1: The solution was to use .value { "script_fields": { "new_date_field": { "script": { "inline": "doc['date