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
0
votes
1 answer

Elastic search painless script issues during re indexing

I want to re-index older data of geoip to geopoints. previous data contains location in this format. "geoip": { "location": { "lon": 67.0703, "lat": 24.9206 } } I want to re-index location in geo point in array like this…
Saad Ahmed
  • 700
  • 1
  • 8
  • 15
0
votes
0 answers

Elasticsearch painless script query loop

We are currently building a search tool based on elasticsearch and our query involves matching nearest value to user input values. Say user inputs [1,10,100,1000,10000] it should return closest value available in our index to each of those elements…
0
votes
1 answer

Filter out null fields

I'm using map/reduce functionality with the painless language to do some aggregation. In the map_script part I am trying to filter out all documents that have a certain field set to null but I am unable to do so. I've tried doing containsKey() and…
Rok Povsic
  • 4,626
  • 5
  • 37
  • 53
0
votes
0 answers

Registering Elasticsearch Script

Is there any way how to register script in ES? Let's say I have script in painless and I want to send it to server and then call it in code.
user1439198
  • 37
  • 2
  • 8
0
votes
1 answer

Query_string in combination with function_score always gives score 1.0

When I am trying to make a query_string request to my Elasticsearch that uses a function_score (script_score) to manipulate its default score. But I always seem to get a base _score of 1.0. My model looks like this: { "name": "Secret Birthday…
Daniel Lerps
  • 5,256
  • 3
  • 23
  • 33
0
votes
1 answer

Getting null_pointer_exception when accessing _aggs elements in Scripted Metric Aggregation

I have an index of stock ticks for every second that look like the following and I am trying to aggregate them together into larger ticks of 5 minutes. Aggregating the high and low is easy using min/max. However the open and close are harder. I am…
dustins
  • 353
  • 5
  • 16
0
votes
1 answer

How do I convert to uppercase and delete a particular field while using reindex?

I am trying to migrate from ES 1.4 to ES 5.5. In one of the index, I need to change the name of field and also convert it's value to uppercase. I am able to reindex with a change in name of field and remove the unwanted field but need help in…
user801116
0
votes
0 answers

How to convert keyword to integer in Kibana 5 using painless script?

I want to order Hour values in Ascending order in a bar chart of Kibana 5: The problem is that the order is 0, 1, 10, 2, ... instead of 0, 1, 2, 3, .... The possible reason is that Hour is a keyword, not integer. In Elasticsearch I can see "Hour":…
Dinosaurius
  • 8,306
  • 19
  • 64
  • 113
0
votes
1 answer

Elasticsearch, why is added Element always null

I have an Elasticsearch-DB and want to add elements (strings) to an array. Following the discussion over here https://discuss.elastic.co/t/append-to-existing-field/16423/2 I set up a toy-model. I init with: curl -XPOST…
david
  • 113
  • 10
0
votes
1 answer

ElasticSearch/Painless: How do I skip an item when iterating?

I have a for loop that iterates a list. If the list contains a certain value, say "5", I want the loop to skip that value. But Painless seems determined to not permit that by not letting me have an empty if block or use a continue statement. How can…
Craig
  • 1,890
  • 1
  • 26
  • 44
0
votes
1 answer

Strip day from elasticsearch date using painless scripting

I have date with this format November 17th 2016, 12:54:29.000" and I need to get that 17 only using painless script. Also if anyone can provide me link to painless script tutorial regarding date formats.
Saurab
  • 1,931
  • 5
  • 20
  • 33
0
votes
1 answer

ES: save current doc into subfield as historic revision

I am trying to implement store older versions within the same document using painless scripting: curl -XPOST http://127.1:9200/index1/type1/docid/_update -d \ {"script": {"inline": "ctx._source.previous.add(ctx._source)"}} The response is { …
est
  • 11,429
  • 14
  • 70
  • 118
0
votes
1 answer

Elasticsearch pipeline to extract fields of an object to a root of document

I'm looking for a way to extract the contents of an object such as { "mdc":{ "key1": "value1", "key2": "value2", ... } } and transform that into { "key1": "value1", "key2": "value2", ... …
zaxme
  • 1,065
  • 11
  • 29
0
votes
1 answer

Using ElasticSearch painless scripting to compute dayOfWeek or timeOfDay

I use ES 5.1.2 and I'm trying to compute day of week and time of day from a date field and consider timezone at the same time. my first script is def d = doc['my_field'].date; d.addHours(10); d.getDayOfWeek(); The error message is can't find…
Ray Wu
  • 993
  • 16
  • 34
0
votes
1 answer

How to run a query with the properties from a stored document?

Let's say we have a index with docs which contain the following fields: uid and hobbies. How can I run a query to find similarities between 1 and the other users, without having to retrieve the user first and then run a new query with his hobbies?
tomwassing
  • 925
  • 1
  • 10
  • 30
1 2 3
32
33