Questions tagged [elasticsearch-painless]

Painless is a scripting language that is purpose-built for Elasticsearch. It was introduced with Elasticsearch 5.0. Painless can be used anywhere in Elasticsearch where scripts can normally be run by specifying the 'lang' parameter as 'painless'.

484 questions
1
vote
2 answers

Elasticsearch - Remove field from a structure

I am using Elasticsearch 6.5. Let say, that my Elasticsearch document looks like this: "_source" : { "field1" : "val1", "field2" : "val2", "struct1" : { "inner_field1" : "inner val1", "inner_field2" : "inner val2", } …
Michał Herman
  • 3,437
  • 6
  • 29
  • 43
1
vote
0 answers

What's the difference between accessing a document field via .value/.values or not in painless script?

Suppose that i have a doc mapping field like below { "template": { "mappings":{ "template":{ "properties": { "sth": { "type": "long" } …
user8510613
  • 1,242
  • 9
  • 27
1
vote
1 answer

Attempting to use Elasticsearch Bulk API when _id is equal to a specific field

I am attempting to bulk insert documents into an index. I need to have _id equal to a specific field that I am inserting. I'm using ES v6.6 POST productv9/_bulk { "index" : { "_index" : "productv9", "_id": "in_stock"}} { "description" : "test",…
cluis92
  • 664
  • 12
  • 35
1
vote
1 answer

How to use value of nested documents in script scoring

Schema looks like this: "mappings": { "_doc": { "_all": { "enabled": false }, "properties": { "category_boost": { "type": "nested", "properties" : { "category": { …
1
vote
1 answer

Import only arrays that match conditions in Elastic Search

I'm dealing with nested nested data in ElasticSearch. I want it to work like a SELECT * from where in an RDBMS. If you have the following data POST test-stack/test/1234_5678 { "Id" : 1234, "availables": [ { "Id" : 4444, "date"…
조민국
  • 89
  • 1
  • 4
1
vote
1 answer

Elasticsearch Painless script search document based on availability

I'm using ES version 7.0. I have a index of stores with availability (opening and closing time) in UTC time. I stored time in Integer so that it can be easy to match with the current time in painless script. One sample doc is below: { …
Avi
  • 434
  • 6
  • 20
1
vote
1 answer

Kibana Painless Scripted Fields

I'm new to Kibana. I've been tasked with replicating an excel report into a dashboard. I want to use a data table to display my values and also have a calculated field for percentages. The percentiles metric is not what I am trying to use to perform…
Mg Mogaki
  • 113
  • 5
  • 13
1
vote
1 answer

what is the least version of kibana that supports painless language

I have Version: 5.4.1 kibana in my PC, now I am trying to re-write the watchers from groovy language to painless. so my question here is if this version of kibana 5.4.1 support painless language or not? I ask the above bcos I see painless…
ganga
  • 402
  • 4
  • 5
1
vote
0 answers

Elasticsearch painless scripting with dates

I have a document which has a date field. I'd like to sort by documents by the this date ASC, but ones with a date in the past i'd like at the end. In my end, it's like i want to assign the document value to a new value: - If date is > "utc now",…
RPM1984
  • 72,246
  • 58
  • 225
  • 350
1
vote
1 answer

elastic, can I use my own global ordinals with a painless terms aggregation script?

Here's what one of my document might look like { "CC":{"colors":["Blue","Green","Yellow"]}, "CN":{"colors":["White","Green","Blue"]}, "WA":{"colors":["Orange","Green","Blue"]}, ... } I want a terms aggregation, on…
1
vote
1 answer

How to convert binary data back to a float array in Elasticsearch/painless

I am trying to efficiently store and retrieve an array of floats in elasticsearch 6.7. Numeroc doc values are sorted, which means I can't use them directly. At first I was using the source value of the field, but the performance on a large query is…
Victor P.
  • 630
  • 1
  • 6
  • 14
1
vote
2 answers

ElasticSearch painless scripts - Way to output variable values besides the final score?

I am using a painless script to implement a custom scoring function while querying the ES index, that's being used as a basis for our recommendation engine. While calculating the final score in the painless script, I use a product of intermediate…
peterkim95
  • 21
  • 1
  • 5
1
vote
2 answers

ElasticSearch - score boosting using scripting

We have a specific use-case for our ElasticSearch instance: we store documents which contain proper names, dates of birth, addresses, ID numbers, and other related info. We use a name-matching plugin which overrides the default scoring of ES and…
Stpete111
  • 3,109
  • 4
  • 34
  • 74
1
vote
1 answer

ElasticSearch sort via a (painless) script - array values are mysteriously deduped

I am PUTting the following document in ElasticSearch: { "_rootId": "327d3aba-4f7c-4abb-9ff3-b1608c354c7c", "_docId": "ID_3", "_ver": 0, "val_labels": [ "x1", "x1", "x1" ] } Then, I GET the following query…
Itay Maman
  • 30,277
  • 10
  • 88
  • 118
1
vote
1 answer

Elasticsearch multilevel nested object filter and update

Elasticsearch : 6.3 I'm trying to update the nested field by filtering the particular Book. Below is the sample record. { "StoreName":"test", "StoreID":"12435", "BookInfo":[ { "Name":"Book1", "Comments":[ …
user77
  • 23
  • 5