What's the correct way to use termsFilter from the Java API?
The method is defined as termsFilter(String name, int... values). This
is fine if you have some fixed number of values to pass in that you
can explicitly enumerate in code, but I have a variably sized list.
I tried passing ArrayList as the parameter. Java accepts this
syntactically, but it doesn't work:
Caused by: java.io.IOException: Type not allowed [class
java.util.ArrayList]
at
org.elasticsearch.common.xcontent.XContentBuilder.value(XContentBuilder.java:
747)
at
org.elasticsearch.index.query.TermsFilterBuilder.doXContent(TermsFilterBuilder.java:
144)
at
org.elasticsearch.index.query.BaseFilterBuilder.toXContent(BaseFilterBuilder.java:
33)
at
org.elasticsearch.index.query.AndFilterBuilder.doXContent(AndFilterBuilder.java:
81)
at
org.elasticsearch.index.query.BaseFilterBuilder.toXContent(BaseFilterBuilder.java:
33)
at
org.elasticsearch.search.builder.SearchSourceBuilder.toXContent(SearchSourceBuilder.java:
548)
at
org.elasticsearch.search.builder.SearchSourceBuilder.buildAsBytesStream(SearchSourceBuilder.java:
501)
... 8 more
What's the correct way to use termsFilter from the Java API?
The method is defined as termsFilter(String name, int... values). This
is fine if you have some fixed number of values to pass in that you
can explicitly enumerate in code, but I have a variably sized list.
I tried passing ArrayList as the parameter. Java accepts this
syntactically, but it doesn't work:
Caused by: java.io.IOException: Type not allowed [class
java.util.ArrayList]
at
org.elasticsearch.common.xcontent.XContentBuilder.value(XContentBuilder.jav a:
747)
at
org.elasticsearch.index.query.TermsFilterBuilder.doXContent(TermsFilterBuil der.java:
144)
at
org.elasticsearch.index.query.BaseFilterBuilder.toXContent(BaseFilterBuilde r.java:
33)
at
org.elasticsearch.index.query.AndFilterBuilder.doXContent(AndFilterBuilder. java:
81)
at
org.elasticsearch.index.query.BaseFilterBuilder.toXContent(BaseFilterBuilde r.java:
33)
at
org.elasticsearch.search.builder.SearchSourceBuilder.toXContent(SearchSourc eBuilder.java:
548)
at
org.elasticsearch.search.builder.SearchSourceBuilder.buildAsBytesStream(Sea rchSourceBuilder.java:
501)
... 8 more
What's the correct way to use termsFilter from the Java API?
The method is defined as termsFilter(String name, int... values). This
is fine if you have some fixed number of values to pass in that you
can explicitly enumerate in code, but I have a variably sized list.
I tried passing ArrayList as the parameter. Java accepts this
syntactically, but it doesn't work:
Caused by: java.io.IOException: Type not allowed [class
java.util.ArrayList]
at
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.