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'.
Questions tagged [elasticsearch-painless]
484 questions
1
vote
2 answers
ElasticSearch Painless: using vector functions in for loops bug
I ran into what seems to be a bug in Painless where if a vector function is used, say l2norm(), the outcome remains the same outcome as the first iteration. I'm using the painless script in a function score, I hope the query below sheds some light.…

jlos
- 1,010
- 1
- 8
- 12
1
vote
2 answers
Elasticsearch update nested field with painless script in ElasticSearch API vs java API
Could someone explain what's wrong with ES java api?
I'm making query to update by script with ES api and it works perfectly (below)
POST user/ut/520411_5752/_update
{
"script": {
"source": "ctx._source.cars.add(params.car)",
"params": {
…

viq
- 317
- 1
- 3
- 17
1
vote
1 answer
How to calcuate starttime & endtime using painless script
I am working with ELK and i have created index pattern with build_date. Now to calculate the Avg of build duration, i need to find the start-time and end-time in minutes using painless script.
My logstash output data given below
"build_end_time" =>…

user4948798
- 1,924
- 4
- 43
- 89
1
vote
1 answer
Return Elasticsearch distance for array of geo points
I need to return the distance for multiple geo points per document in an Elasticsearch array. As of now, my results only return one distance calculated for the array.
I started with the code from the following StackOverflow question:
Return distance…

UserX
- 71
- 7
1
vote
1 answer
Get date value in update query elasticsearch painless
I'm trying to get millis value of two dates and subtract them to another.
When I used ctx._sourse.begin_time.toInstant().toEpochMilli() like doc['begin_time'].value.toInstant().toEpochMilli() it gives me runtime error.
And…

mamol
- 91
- 2
- 11
1
vote
2 answers
How to display Due, Over Due and Not Due based on a date field in Saved Search
For example I have a date field delivery_datetime in Index, I have to show the user for the current day whether a particular parcel is Due today or Over Due or Not Due
I can't create a separate field and do reindex because it's based on current date…

Balakrishnan
- 2,403
- 2
- 26
- 47
1
vote
1 answer
elasticsearch painless script to add object field into document
I have a rather basic requirement, I would like to add an object to a document with painless within a query for update.
This is the object I would like to add
"memoire": {
"codeActe": "C",
"docType": "M",
"uuid": "added ",
…

christophe spielmann
- 75
- 1
- 6
1
vote
0 answers
Implement collocation in ElasticSearch
I am new in Elastic Search Usage I am trying to do an analyser or an ingest pipeline that would create collocations of words ( unigram, bigrams, trigrams with a step up to 2 ) . I am aware it's feasible in python but I am only interested in an ES…

Axel
- 186
- 3
- 11
1
vote
1 answer
Filter on day of the week and aggregate on hour
For my master, I have a programming course in which I have to work with Elasticsearch. I have a dataset with a few million Ubereat orders. Every record consists of the dateTime, restaurant, pickup point and dropoff point. I had to distinguish…

Leo
- 11
- 2
1
vote
0 answers
Elasticsearch - Update a field of several records already indexed based on a value from a new record still not indexed
I need to update a field of several records already indexed based on a value from a new record still not indexed. Is there any way to implement it?
The table below describes my index with current docs. The yellow line would be a new doc…

Lavor
- 71
- 5
1
vote
1 answer
Painless scripting initialize new array
I'm trying to add or update a nested object in Elasticsearch using a script. Below script works fine if integrations is already an array, but when it is null, below script throws a null pointer exception. How do I initialize ctx._source.integrations…

Bart van den Burg
- 2,166
- 4
- 25
- 42
1
vote
1 answer
Elasticsearch script: can a nested date be accessed directly as a date object?
In my ES data, there are nested and parent date fields. I need to use these dates in one ES painless script. It is easy to operate with the parent date as it is treated as a time object. For example, to transform parent dates doc['validFrom'] to…

Mikhail Geyer
- 881
- 2
- 9
- 27
1
vote
1 answer
How to modify data table column values in Kibana
In Elastic search we store events, I have built data table which aggregates based on event types. I have filter which checks for event.keyword : "job-completed". I am getting the count as 1 or 0 but i want to display as completed / in-progress.
How…

Ganesh M
- 33
- 2
- 6
1
vote
1 answer
ElasticSearch 'bucket_script' not executing when one of the bucket paths resolves to 'null'
Let's assume there's a (simplified) index:
PUT test
{
"mappings": {
"properties": {
"numeric_field_sometimes_empty": {
"type": "integer"
},
"numeric_field_always_present": {
"type": "integer"
}
}
…

Joe - GMapsBook.com
- 15,787
- 4
- 23
- 68
1
vote
1 answer
Extract date (yyyyMMdd) from date field in ElasticSearch query
My index has a date field formatted as 2020-01-04T05:00:06.870000Z. In the ES query response, I need the date in the form yyyyMMdd, so 20200104. I tried using scripted query and extracted the day, month and year individually. How can i concatenate…

user379151
- 1,289
- 1
- 16
- 25