Hi,
I'm curious how scripts work in ES.
I've created a simple script which checks if a field in a record is equal
to a certain value then return 1 otherwise return 0. I used
AbstractDoubleSearchScript as the super class for this script.
My records contains some a data field that is an int and a date field
(long) (some other ones too that I don't care too much yet)
What I've noticed is that when I execute the script, each record in the ES
db goes through the script and is returned either w a score of 0 or 1.
What I would like to know is if it is possible to do a range query, say
given 2 date params, and select only the records that fall between those
dates to run through the script.
I know how to do this with the API but not in script format. For example
this non script code works:
SearchRequestBuilder s = client.prepareSearch("posts")
.setQuery(QueryBuilders.queryString(query).defaultField("post.body"))
.setSize(count)
.setFrom(start)
.setFilter(FilterBuilders.rangeFilter("post.creationDate").from(interval.getStart.toString()).to(interval.getEnd.toString()))
.setFilter(FilterBuilders.existsFilter("userId"));
s.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
But when extending AbstractDoubleSearchScript I have access only to a few
things like doc(), source(), fields(), lookup() and I'm not sure how to
filter records.
Also I can't find documentation on what these are ie: what is source()
other than a Map.
Any help on filtering is greatly appreciated!
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/1673cee1-468e-462b-85a4-c8e45fa74156%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.