Questions tagged [elasticsearch-scripting]

With scripting, you can evaluate custom expressions in Elasticsearch. For example, you could use a script to return "script fields" as part of a search request or evaluate a custom score for a query.

The default scripting language is Painless. Additional lang plugins enable you to run scripts written in other languages. Everywhere a script can be used, you can include a lang parameter to specify the language of the script.

Source: official documentation.

26 questions
0
votes
1 answer

cannot convert MethodHandle(Dates)JodaCompatibleZonedDateTime to (Object)double

I am trying to add conditions if field exist, then sort according to it otherwise use another field. Since one of either will exist. Here is my query: GET /my_index/_search { "query": { "match_all": {} }, "sort": { "_script": { …
iBug
  • 2,334
  • 3
  • 32
  • 65
0
votes
2 answers

Partially updating elasticsearch list field value using python

The purpose of this question is to ask the community how to go about partially updating a field without removing any other contents of that field. There are many examples in StackOverflow to partially update ElasticSearch _source fields using…
0
votes
1 answer

Best practice to do customized mapping in Elasticsearch aggregation

I want to carry out a customized aggregation through mapping a certain field in ES doc. I try to leverage terms aggregation script. There're hundreds of mappings so that I have to put all of them into a HashMap: GET /myindex/_search { "query":…
cosimoth
  • 167
  • 10
0
votes
1 answer

ElasticSearch Script query is ignoring decimals from double value

I'm using below query to fetch double value but it is ignoring decimals after dot. POST gs011_tasks/_search { "from": 0, "size": 0, "version": true, "aggregations": { "DB_PLOTS": { "terms": { "script": { …
Ram Prasad
  • 13
  • 2
0
votes
0 answers

How to significantly minimize the elasticsearch query execution time of the query that has aggregation with script

I have around 17 million documents(Its gradually increasing) in the elastic-search index, Mapping of one of the property labels that is used for aggregation is { "mappings":{ "labels":{ "properties":{ "label":{ …
0
votes
0 answers

Root mapping definition has unsupported parameters(mapper_parsing_exception) while running elastic search painless script

{ "query": { "match_all": {} }, "script": { "source":"if(ctx._source.containsKey('priority')){if (ctx._source.priority != null && ctx._source.priority != 'null') { ctx._source.priority_filter = …
0
votes
1 answer

Elasticsearch scripting array size

Can anyone help me to construct below query. I get below error, when running this query. ES version is 7.9.0; In my model there is a field "repliedBy" which is an array field. It's value is always initialized with empty array. But on some entities…
Rufat Gulabli
  • 634
  • 6
  • 10
0
votes
1 answer

Filtering documents by an unknown value of a field

I'm trying to create a query to filter my documents by one (can be anyone) value from a field (in my case "host.name"). The point is that I don't know previously the unique values of this field. I need found these and choose one to be used in the…
0
votes
1 answer

How to concatenate a Object instead whole them replace using Update API (painless) on write ElasticSearch

Scenario: have a document A on ElasticSearch and I want concatenate on this document some fields existing on document B. Document A: { "id": 121423, "name": "Sample Name", "timestamp": "2020-10-01T00:12:00", "age": 24 } Document…
0
votes
1 answer

How to update and strip the first character of an array field in elasticsearch

I have the following within an index in elastic search listed as a json doc Current { "bar": { "bar": [{ "bar": [{ "bar": [{ "foo": "Y111111111111" } …
Jordan Cheeks
  • 103
  • 1
  • 1
  • 9
0
votes
1 answer

Elasticsearch: Aggregation For Random Fields

enter image description here Now I have a document like the picture. The Structure of this document is "contents" field with many random key field(Notice that there isn't a fixed format for keys.They may just be like UUIDs ). I want to find the…
1
2