Debugging scripts

2014-05-16 Thread Mike Snare
I'm trying to debug an MVEL script that's failing in production but working 
locally, and I've tried to do logging a couple different ways, but I can 
only get logging to work locally.

Both local and production are running 1.1.1, same exact build.  Both are 
running with java 1.7._55.

I've tried the logger approach based 
on 
https://github.com/imotov/elasticsearch-test-scripts/blob/master/logging_from_script.sh,
 
but that only works when the server is running under java 1.6.  Under 1.7, 
both local and production fail.

I've tried using System.out.println, but that only works locally even under 
java 1.7.  In production I just get error: 
ElasticsearchIllegalArgumentException[failed to execute script]; nested: 
PropertyAccessException[[Error: unresolvable property or identifier: 
]\n[Near : {... System.out.println(\SCRIPT: }]\n ^\n[Line: 12, Column: 
1]]; 

Does anyone have any pointers as to how to debug MVEL or get log output 
from MVEL scripts in ES?

-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/c6914ca7-a4da-4bb5-97c6-4a299d68d2c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Filter any documents containing any of several values in a number of fields

2014-04-29 Thread Mike Snare
Bump

-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/fad5147a-4a5d-444c-8ac5-9f404e098e9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Filter any documents containing any of several values in a number of fields

2014-04-28 Thread Mike Snare
Is there any way to construct a filter that will filter out any documents 
that match any values in an array from, say, 2 different fields?

Imagine a document that stores friendships/recommendations/etc, where the 
document might store ids for each user as user_1 and user_2, and then other 
information in whatever other fields you'd need.  The important thing is 
the user_1 and user_2 fields, but here's an idea of what the doc might look 
like:

{
  user_1: 12345,
  user_2: 23456,
  facebook_friends: true,
  twitter_friends: false,
  comments: blahblahblahh
}

I would like to execute a query that returns a set of documents but 
excludes any friendships for a list of user ids.  These excluded user_ids 
might be listed as user_1 in some docs, but might be listed as user_2 in 
others.  I can easily construct a terms query for each field that will say 
exclude where user_1 is any of these values AND THEN exclude where user_2 
is any of these values but what I'd like to do is say exclude where 
either user_1 or user_2 are any of these values.

Right now I have to do this:

{
  query: {
filtered: {
  query: {
// whatever...
  },
  filter: {
bool: {
  must_not: [
{
  terms: { 
user_1: [12345, 23456]
},
{
  terms: { 
user_2: [12345, 23456]
}
  ]
}
  }
}
  }
}

Some of these filters end up getting pretty large, and I'd like to be able 
to avoid duplicating the array within the same query if I can.  Something 
like this would be awesome, but I can't figure out if there's any way to do 
it:

{
  query: {
filtered: {
  query: {
// whatever...
  },
  filter: {
not: {
  multi_match: {
terms: [user_1, user_2],
values: [12345, 23456]
  }
}
  }
}
  }
}

Thanks,
-Mike

-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/4fcef91a-3f44-4452-acb3-dc704c8c2005%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.