How to set values at run time in ES addFilter

AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("Education", getZeducation()));
log.debug(FilterBuilders.prefixFilter("Education", getZeducation()));
queryFilters.add(FilterBuilders.prefixFilter("ResumeHeadline", getZresumeHeadline()));
FilterBuilder aggFilter = FilterBuilders.andFilter(queryFilters);
SearchResponse response = client.prepareSearch("resume_index")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(QueryBuilders.prefixQuery("Name",getZname()))
.setFilter(aggFilter)
.setFrom(10)
.setSize(60)
.setExplain(true)
.execute()
.actionGet();

Error:
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [dfs], total failure; shardFailures {[W17rw9RHRyeEZGi-aBVlmQ][resume_index][0]: SearchParseException[[resume_index][0]: query[Name:szeducation=mcazresumeHeadline=asp*],from[10],size[60]: Parse Failure [Failed to parse source [{"from":10,"size":60,"query":{"prefix":{"Name":"szeducation=mcazresumeHeadline=asp"}},"filter":{"and":{"filters":[{"and":{"filters":[{"prefix":{"Education":null}},{"prefix":{"ResumeHeadline":null}}]}}]}},"explain":true}]]]; nested: QueryParsingException[[resume_index] No value specified for prefix filter]; }{[W17rw9RHRyeEZGi-aBVlmQ][resume_index][2]: SearchParseException[[resume_index][2]: query[Name:szeducation=mcazresumeHeadline=asp*],from[10],size[60]: Parse Failure [Failed to parse source [{"from":10,"s

I don't know how many time I will have to repeat the same answer to your problem.
Is there something you don't understand in my answer? If so, please tell me what.

My answer is always the same: don't provide null value to the prefixFilter.

Check in your code why getZname() is returning null.

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 25 févr. 2013 à 06:41, mukesh mukeshp073@gmail.com a écrit :

AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("Education",
getZeducation()));
log.debug(FilterBuilders.prefixFilter("Education", getZeducation()));
queryFilters.add(FilterBuilders.prefixFilter("ResumeHeadline",
getZresumeHeadline()));
FilterBuilder aggFilter = FilterBuilders.andFilter(queryFilters);
SearchResponse response = client.prepareSearch("resume_index")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(QueryBuilders.prefixQuery("Name",getZname()))
.setFilter(aggFilter)
.setFrom(10)
.setSize(60)
.setExplain(true)
.execute()
.actionGet();

Error:
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [dfs], total failure; shardFailures
{[W17rw9RHRyeEZGi-aBVlmQ][resume_index][0]:
SearchParseException[[resume_index][0]:
query[Name:szeducation=mcazresumeHeadline=asp*],from[10],size[60]: Parse
Failure [Failed to parse source
[{"from":10,"size":60,"query":{"prefix":{"Name":"szeducation=mcazresumeHeadline=asp"}},"filter":{"and":{"filters":[{"and":{"filters":[{"prefix":{"Education":null}},{"prefix":{"ResumeHeadline":null}}]}}]}},"explain":true}]]];
nested: QueryParsingException[[resume_index] No value specified for prefix
filter]; }{[W17rw9RHRyeEZGi-aBVlmQ][resume_index][2]:
SearchParseException[[resume_index][2]:
query[Name:szeducation=mcazresumeHeadline=asp*],from[10],size[60]: Parse
Failure [Failed to parse source [{"from":10,"s

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/How-to-set-values-at-run-time-in-ES-addFilter-tp4030442.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--
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.

Thanks for reply .Problem now solved
I had post both at same time..........

On Tue, Feb 26, 2013 at 12:44 PM, dadoonet [via Elasticsearch Users] <
ml-node+s115913n4030520h61@n3.nabble.com> wrote:

I don't know how many time I will have to repeat the same answer to your
problem.
Is there something you don't understand in my answer? If so, please tell
me what.

My answer is always the same: don't provide null value to the
prefixFilter.

Check in your code why getZname() is returning null.

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 25 févr. 2013 à 06:41, mukesh <[hidden email]http://user/SendEmail.jtp?type=node&node=4030520&i=0>
a écrit :

AndFilterBuilder queryFilters = FilterBuilders.andFilter();
queryFilters.add(FilterBuilders.prefixFilter("Education",
getZeducation()));
log.debug(FilterBuilders.prefixFilter("Education",
getZeducation()));
queryFilters.add(FilterBuilders.prefixFilter("ResumeHeadline",
getZresumeHeadline()));
FilterBuilder aggFilter =
FilterBuilders.andFilter(queryFilters);
SearchResponse response = client.prepareSearch("resume_index")

.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)

.setQuery(QueryBuilders.prefixQuery("Name",getZname()))
.setFilter(aggFilter)
.setFrom(10)
.setSize(60)
.setExplain(true)
.execute()
.actionGet();

Error:
org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to
execute phase [dfs], total failure; shardFailures
{[W17rw9RHRyeEZGi-aBVlmQ][resume_index][0]:
SearchParseException[[resume_index][0]:
query[Name:szeducation=mcazresumeHeadline=asp*],from[10],size[60]: Parse
Failure [Failed to parse source
[{"from":10,"size":60,"query":{"prefix":{"Name":"szeducation=mcazresumeHeadline=asp"}},"filter":{"and":{"filters":[{"and":{"filters":[{"prefix":{"Education":null}},{"prefix":{"ResumeHeadline":null}}]}}]}},"explain":true}]]];

nested: QueryParsingException[[resume_index] No value specified for prefix
filter]; }{[W17rw9RHRyeEZGi-aBVlmQ][resume_index][2]:
SearchParseException[[resume_index][2]:
query[Name:szeducation=mcazresumeHeadline=asp*],from[10],size[60]: Parse
Failure [Failed to parse source [{"from":10,"s

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/How-to-set-values-at-run-time-in-ES-addFilter-tp4030442.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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 [hidden email]http://user/SendEmail.jtp?type=node&node=4030520&i=1.

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 [hidden email]http://user/SendEmail.jtp?type=node&node=4030520&i=2.

For more options, visit https://groups.google.com/groups/opt_out.


If you reply to this email, your message will be added to the discussion
below:

http://elasticsearch-users.115913.n3.nabble.com/How-to-set-values-at-run-time-in-ES-addFilter-tp4030442p4030520.html
To unsubscribe from How to set values at run time in ES addFilter, click
herehttp://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4030442&code=bXVrZXNocDA3M0BnbWFpbC5jb218NDAzMDQ0MnwtNjU5NDA5MjU2
.
NAMLhttp://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html!nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers!nabble%3Aemail.naml-instant_emails!nabble%3Aemail.naml-send_instant_email!nabble%3Aemail.naml

--
mukeshp073@gmail.com
Laitkor.pvt ltd