Questions tagged [mvel]

MVEL is a powerful expression language for Java-based applications.

MVEL is a powerful expression language for Java-based applications.

192 questions
4
votes
1 answer

Error translating mvel script to groovy

While preparing for an update to elasticsearch 2.0, I noticed mvel scripting is being deprecated in favor of groovy. My problem is that I am new to groovy and don't know how to fix this error. boolean engineTest = false; if (!engineTest) {…
Danny
  • 77
  • 4
4
votes
2 answers

Optional Parameter in MVEL Functions

Is there a way to get MVEL 2.0 ( http://mvel.codehaus.org/ ) to work with functions with optional parameters? I would like to be able to eval this: trunc('blahblah',2) but also trunc('blahblah',2,'[...]'); Now i have tried: def…
JP-Ulm
  • 161
  • 1
  • 2
  • 6
4
votes
1 answer

Drools: Differences between the mvel and java dialects

As a newbie to Drools, I'm confused about the differences between the mvel and java dialects and the relative pros and cons of using either. After some initial research, I came across some discussions here, and here. What other differences are…
dshgna
  • 790
  • 1
  • 14
  • 33
4
votes
1 answer

Mvel iterate a list

I have this class hierarchy StudentClass .java public class StudentClass { private List studentList; public List getStudentList() { return studentList; } public void setStudentList(List
Ankur Singhal
  • 23,626
  • 10
  • 70
  • 108
4
votes
2 answers

ElasticSearch Get Time in Groovy Script

My application is using this script for boosting more recent items in the index: (5 / ((3.16*pow(10,-11)) * abs(time() - doc[\'date\'].date.getMillis()) + 0.2)) + 1.0 It's written in MVEL, but as of 1.3, MVEL is deprecated for Groovy. The script…
Jonah
  • 9,535
  • 5
  • 39
  • 74
4
votes
1 answer

Boolean value scripting issue with MVEL and Elasticsearch

I have a field mapping defined as {"top_seller":{"type":"boolean"}} In my query, I'm trying to do a custom score query based on the boolean value. I'm pulling my hair out. Every time I run a script such as this: return…
J.T.
  • 2,596
  • 12
  • 30
4
votes
1 answer

How do I get the count/size of an array in elasticsearch

I want to do a statistical facet on one of my arrays. I hope something like "script" : "doc['myField'].doubleValue or "script" : "doc['myField'].count would work. I havent found any array count method in mvel and I don't even know if accessing the…
Alden
  • 272
  • 4
  • 12
3
votes
1 answer

How to parse the templated sentence "#{name} invited you" using expression language

I am a new bee to Java. My intension is to use the template like sentences in Java program (no JSP or any web related pages) Example: String name = "Jon"; "#{ name } invited you"; or String user.name = "Jon"; "#{ user.name } invited…
Jon
  • 2,495
  • 3
  • 14
  • 14
3
votes
0 answers

Mvel expression compilation passes but evaluation fails

I'm using Mvel API mvel2 2.4.4.Final to write some rule based logic's in my java web application. I have list of Mvel Expressions which should be compiled before I use them in real operations to avoid any invalid expression problems while client…
jiboOne
  • 541
  • 5
  • 18
3
votes
3 answers

Create a array in mvel expression and check if variable exists in array

I have a variable having some numeric value x = 5;. I want to right an expression like: if arr = [4,7,10] contains x in mvel. Is that possible, if yes, how ? As of now I will have to right expression as : x == 4 || x == 7 || x == 10 but since i may…
GP007
  • 601
  • 1
  • 8
  • 22
3
votes
1 answer

How to pass arguments to a function written inside an MVEL expression?

I have a JAVA class that has two methods. The first one is the main method and the second one is method1(). Let's say the following is the class: public class SomeClass() { public static void main(String[] args) { SomeClass myObj = new…
Anuj
  • 87
  • 1
  • 9
3
votes
2 answers

How to do a minus operation on time-stamps in elasticsearch?

I have some server logs dumped into elasticsearch. The logs contain entries like 'action_id':'AU11nP1mYXS3pt6INMtU','action':'start','time':'March 31st 2015, 19:42:07.121' and 'action_id':'AU11nP1mYXS3pt6INMtU','action':'complete','time':'March 31st…
lingxiao
  • 1,106
  • 12
  • 29
3
votes
2 answers

Extract all particular field from JSON in mule esb

I have this json payload, I would want to collect all externalListingId in one shot - { "listings": { "numFound": 3, "listing": [ { "status": "INACTIVE", "pricePerTicket": { "amount": 100, …
user3483129
  • 137
  • 5
  • 17
3
votes
2 answers

Mvel evaluation

Problem Statement: Say I have a expression (a + b + c), and I want to calculate its value and assign to some variable. Later I want use that variable value in some other logic. This is all done through MVEL. Issue is if anyone out of (a,b,c) is…
Ankur Singhal
  • 23,626
  • 10
  • 70
  • 108
3
votes
1 answer

Calculating Distance on a MultiValueField Location

In my ElasticSearch index, location is a MultiValueField. When I write a custom scoring formula for my documents involving location, I want the script to pick up on whichever location is the closest to the point in my query. So, I have this part of…
ajyang818
  • 485
  • 1
  • 3
  • 14
1
2
3
12 13