Filter facet results to exclude not wanted terms

I have a facet to count shingles, now I want to filter the facet results to
exclude shingles given a simple rule I'm expressing as a regex using script:

{
"query": {
"match_all": {}
},
"facets": {
"blah": {
"terms": {
"field": "text.shingles",
"size": "400",
"script": {

                "script": "term.match(new RegExp(regex, 'i')) ? false : 

true",
"lang": "js",
"params": {
"regex":
"(.)(1|2|3|a|en|yo|tu|ti|tus|ellos|nos|su|sus|por|en|de|del|el|le|la|lo|las|los|les|con|no|y|t|que|me|para|da|san|mi|un|una|te|es|esa|ese|esos|esta|este|estos|estas|ya|se|como|to|be|the|si|ya)"
}
}
}
}
}
}

This works as it does remove those shingles that match the regex, however
it takes a lot of time.

What's the smart way of achieving the same?

Thanks

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Why not use terms facet exclude parameter since you do Not seem to have any wildcard in your regexp or facet_filter if you need more complex logic?

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

There is a wildcard. Notice the (.) at the beginning of the regex. Since I
want to exclude 2-fold shingles, the regex is matching only the second
term. I had prefered using (\s) instead of (.) but it does not work.

On Thursday, June 27, 2013 2:21:58 PM UTC-4, AlexR wrote:

Why not use terms facet exclude parameter since you do Not seem to have
any wildcard in your regexp or facet_filter if you need more complex logic?

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hey,

faceting on an analyzed (like a shingle) field will increase the chances of
running out of memory at some time, because your are basically un-inverting
the lucene inverted index and put it into memory. Maybe there is another
solution for your problem, if you can tell us a bit more about what you try
to achieve (in a broader context).

--Alex

On Thu, Jun 27, 2013 at 10:04 PM, Santiago Gaviria sgaviria@gmail.comwrote:

There is a wildcard. Notice the (.) at the beginning of the regex. Since I
want to exclude 2-fold shingles, the regex is matching only the second
term. I had prefered using (\s) instead of (.) but it does not work.

On Thursday, June 27, 2013 2:21:58 PM UTC-4, AlexR wrote:

Why not use terms facet exclude parameter since you do Not seem to have
any wildcard in your regexp or facet_filter if you need more complex logic?

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.