Quantcast

How to set values at run time in ES addFilter

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to set values at run time in ES addFilter

mukesh


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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to set values at run time in ES addFilter

dadoonet
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 ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


Le 25 févr. 2013 à 06:41, mukesh <[hidden email]> 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].
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to set values at run time in ES addFilter

mukesh
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] <[hidden email]> 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 ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


Le 25 févr. 2013 à 06:41, mukesh <[hidden email]> 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].
--
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].

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



--
[hidden email]
Laitkor.pvt ltd
Loading...