First, I want to thank you for this list - I'm new to ES and it's been
extremely helpful.
I've looked through all the articles I can find on filters and have
read the ES guide too.
I still can't figure out how to create a filtered query that includes
ANDs and ORs using the Java API.
I am trying to do this;
QueryString("a text phrase")
filters;
and (A and B)
or(C and not D)
I can filter my QueryString with the AND filter, but don't see how to
add the OR filter;
QueryBuilder qb = QueryBuilders.queryString("a text phrase")
.defaultOperator(Operator.AND)
.field("textField-1").field("textField-2");
AndFilterBuilder andFilter = FilterBuilders.andFilter();
andFilter.add(FilterBuilders.termFilter("textField-3", "a quick
brown fox"))
.add(FilterBuilders.termFilter("code-1", "123"));
OrFilterBuilder orFilter = FilterBuilders.orFilter();
orFilter.add(FilterBuilders.termFilter("textField-3", "jumps over
First, I want to thank you for this list - I'm new to ES and it's been
extremely helpful.
I've looked through all the articles I can find on filters and have
read the ES guide too.
I still can't figure out how to create a filtered query that includes
ANDs and ORs using the Java API.
I am trying to do this;
QueryString("a text phrase")
filters;
and (A and B)
or(C and not D)
I can filter my QueryString with the AND filter, but don't see how to
add the OR filter;
QueryBuilder qb = QueryBuilders.queryString("a text phrase")
.defaultOperator(Operator.AND)
.field("textField-1").field("textField-2");
AndFilterBuilder andFilter = FilterBuilders.andFilter();
andFilter.add(FilterBuilders.termFilter("textField-3", "a quick
brown fox"))
.add(FilterBuilders.termFilter("code-1", "123"));
OrFilterBuilder orFilter = FilterBuilders.orFilter();
orFilter.add(FilterBuilders.termFilter("textField-3", "jumps over
the lazy dog"));
First, I want to thank you for this list - I'm new to ES and it's been
extremely helpful.
I've looked through all the articles I can find on filters and have
read the ES guide too.
I still can't figure out how to create a filtered query that includes
ANDs and ORs using the Java API.
I am trying to do this;
QueryString("a text phrase")
filters;
and (A and B)
or(C and not D)
I can filter my QueryString with the AND filter, but don't see how to
add the OR filter;
QueryBuilder qb = QueryBuilders.queryString("a text phrase")
.defaultOperator(Operator.AND)
.field("textField-1").field("textField-2");
AndFilterBuilder andFilter = FilterBuilders.andFilter();
andFilter.add(FilterBuilders.termFilter("textField-3", "a quick
brown fox"))
.add(FilterBuilders.termFilter("code-1", "123"));
OrFilterBuilder orFilter = FilterBuilders.orFilter();
orFilter.add(FilterBuilders.termFilter("textField-3", "jumps over
the lazy dog"));
What I meant is that you have a "and" part and an "or" part, but what is
the relatiobship between the two. You can wrap them in "or" / "and" as well
to create a compound option.
First, I want to thank you for this list - I'm new to ES and it's been
extremely helpful.
I've looked through all the articles I can find on filters and have
read the ES guide too.
I still can't figure out how to create a filtered query that includes
ANDs and ORs using the Java API.
I am trying to do this;
QueryString("a text phrase")
filters;
and (A and B)
or(C and not D)
I can filter my QueryString with the AND filter, but don't see how to
add the OR filter;
QueryBuilder qb = QueryBuilders.queryString("a text phrase")
.defaultOperator(Operator.AND)
.field("textField-1").field("textField-2");
AndFilterBuilder andFilter = FilterBuilders.andFilter();
andFilter.add(FilterBuilders.termFilter("textField-3", "a quick
brown fox"))
.add(FilterBuilders.termFilter("code-1", "123"));
OrFilterBuilder orFilter = FilterBuilders.orFilter();
orFilter.add(FilterBuilders.termFilter("textField-3", "jumps over
the lazy dog"));
What I meant is that you have a "and" part and an "or" part, but what is
the relatiobship between the two. You can wrap them in "or" / "and" as well
to create a compound option.
First, I want to thank you for this list - I'm new to ES and it's been
extremely helpful.
I've looked through all the articles I can find on filters and have
read the ES guide too.
I still can't figure out how to create a filtered query that includes
ANDs and ORs using the Java API.
I am trying to do this;
QueryString("a text phrase")
filters;
and (A and B)
or(C and not D)
I can filter my QueryString with the AND filter, but don't see how to
add the OR filter;
QueryBuilder qb = QueryBuilders.queryString("a text phrase")
.defaultOperator(Operator.AND)
.field("textField-1").field("textField-2");
AndFilterBuilder andFilter = FilterBuilders.andFilter();
andFilter.add(FilterBuilders.termFilter("textField-3", "a quick
brown fox"))
.add(FilterBuilders.termFilter("code-1", "123"));
OrFilterBuilder orFilter = FilterBuilders.orFilter();
orFilter.add(FilterBuilders.termFilter("textField-3", "jumps over
the lazy dog"));
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.