Does filter term/terms support multiple fields/values in java api?

Hi All,

I have the a query that successfully run on rest api as following :

{
"query": {
"filtered" : {
"query" : {
"query_string" : {
"query" : "kimchy"
}
},
"filter" : {
"term" : { "message" : "trying out", "post_date" : "2009-11-15T14:12:12"}
}
}
}

}

but how i could replicate that in java code ? I m trying to build the
filterTerm by

TermFilterBuilder termfilter = FilterBuilders.termFilter("TYPE_ID", "2");

however i can't find a way to set mutiple fields with terms.

Thanks.

Cyril

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

Hey Cyril,

Are you sure that TermFilter supports multiple terms?
Never heard about it. Not documented either.

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

Le 31 juil. 2013 à 07:48, cyrilforce cheehoo84@gmail.com a écrit :

Hi All,

I have the a query that successfully run on rest api as following :

{
"query": {
"filtered" : {
"query" : {
"query_string" : {
"query" : "kimchy"
}
},
"filter" : {
"term" : { "message" : "trying out", "post_date" : "2009-11-15T14:12:12"}
}
}
}

}

but how i could replicate that in java code ? I m trying to build the filterTerm by

TermFilterBuilder termfilter = FilterBuilders.termFilter("TYPE_ID", "2");

however i can't find a way to set mutiple fields with terms.

Thanks.

Cyril

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.

Hi,

Sry. Further testing on the query with following variation :

  1. "term" : { "user" : "kimchy", "post_date" : "2009-11-15T14:12:12"} -
    Return Result

  2. "term" : { "user" : "kimchy1", "post_date" : "2009-11-15T14:12:12"} -
    Return Result

3)"term" : { "user" : "kimchy", "post_date" : "2009-11-15T14:12:11"} -
Return empty

Conclusion : It picks up the last occurrence of field for the term.
Therefore i guess term does not support multiple fields.

Someone just pass me the query and yup the document doesn't indicate it is
supported however just wanted to confirm :).

Anyway thanks a lot David.

On Wed, Jul 31, 2013 at 2:11 PM, David Pilato david@pilato.fr wrote:

Hey Cyril,

Are you sure that TermFilter supports multiple terms?
Never heard about it. Not documented either.

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

Le 31 juil. 2013 à 07:48, cyrilforce cheehoo84@gmail.com a écrit :

Hi All,

I have the a query that successfully run on rest api as following :

{
"query": {
"filtered" : {
"query" : {
"query_string" : {
"query" : "kimchy"
}
},
"filter" : {
"term" : { "message" : "trying out", "post_date" : "2009-11-15T14:12:12"}
}
}
}

}

but how i could replicate that in java code ? I m trying to build the
filterTerm by

TermFilterBuilder termfilter = FilterBuilders.termFilter("TYPE_ID", "2");

however i can't find a way to set mutiple fields with terms.

Thanks.

Cyril

--
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 a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/jNpeO_FzZDg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Regards,

Chee Hoo

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

So use a Bool Filter to wrap multiple TermFilter queries in a must clause.
Or AndFilter.

See http://www.elasticsearch.org/guide/reference/java-api/query-dsl-filters/

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

Le 31 juil. 2013 à 08:26, chee hoo lum cheehoo84@gmail.com a écrit :

Hi,

Sry. Further testing on the query with following variation :

  1. "term" : { "user" : "kimchy", "post_date" : "2009-11-15T14:12:12"} - Return Result

  2. "term" : { "user" : "kimchy1", "post_date" : "2009-11-15T14:12:12"} - Return Result

3)"term" : { "user" : "kimchy", "post_date" : "2009-11-15T14:12:11"} - Return empty

Conclusion : It picks up the last occurrence of field for the term. Therefore i guess term does not support multiple fields.

Someone just pass me the query and yup the document doesn't indicate it is supported however just wanted to confirm :).

Anyway thanks a lot David.

On Wed, Jul 31, 2013 at 2:11 PM, David Pilato david@pilato.fr wrote:

Hey Cyril,

Are you sure that TermFilter supports multiple terms?
Never heard about it. Not documented either.

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

Le 31 juil. 2013 à 07:48, cyrilforce cheehoo84@gmail.com a écrit :

Hi All,

I have the a query that successfully run on rest api as following :

{
"query": {
"filtered" : {
"query" : {
"query_string" : {
"query" : "kimchy"
}
},
"filter" : {
"term" : { "message" : "trying out", "post_date" : "2009-11-15T14:12:12"}
}
}
}

}

but how i could replicate that in java code ? I m trying to build the filterTerm by

TermFilterBuilder termfilter = FilterBuilders.termFilter("TYPE_ID", "2");

however i can't find a way to set mutiple fields with terms.

Thanks.

Cyril

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 a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/jNpeO_FzZDg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Regards,

Chee Hoo

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.

Cool. Thanks for the link and immediate response.

-Cyril-

On Wed, Jul 31, 2013 at 2:31 PM, David Pilato david@pilato.fr wrote:

So use a Bool Filter to wrap multiple TermFilter queries in a must clause.
Or AndFilter.

See
http://www.elasticsearch.org/guide/reference/java-api/query-dsl-filters/

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

Le 31 juil. 2013 à 08:26, chee hoo lum cheehoo84@gmail.com a écrit :

Hi,

Sry. Further testing on the query with following variation :

  1. "term" : { "user" : "kimchy", "post_date" : "2009-11-15T14:12:12"} -
    Return Result

  2. "term" : { "user" : "kimchy1", "post_date" : "2009-11-15T14:12:12"} -
    Return Result

3)"term" : { "user" : "kimchy", "post_date" : "2009-11-15T14:12:11"} -
Return empty

Conclusion : It picks up the last occurrence of field for the term.
Therefore i guess term does not support multiple fields.

Someone just pass me the query and yup the document doesn't indicate it is
supported however just wanted to confirm :).

Anyway thanks a lot David.

On Wed, Jul 31, 2013 at 2:11 PM, David Pilato david@pilato.fr wrote:

Hey Cyril,

Are you sure that TermFilter supports multiple terms?
Never heard about it. Not documented either.

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

Le 31 juil. 2013 à 07:48, cyrilforce cheehoo84@gmail.com a écrit :

Hi All,

I have the a query that successfully run on rest api as following :

{
"query": {
"filtered" : {
"query" : {
"query_string" : {
"query" : "kimchy"
}
},
"filter" : {
"term" : { "message" : "trying out", "post_date" : "2009-11-15T14:12:12"}
}
}
}

}

but how i could replicate that in java code ? I m trying to build the
filterTerm by

TermFilterBuilder termfilter = FilterBuilders.termFilter("TYPE_ID",
"2");

however i can't find a way to set mutiple fields with terms.

Thanks.

Cyril

--
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 a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/jNpeO_FzZDg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Regards,

Chee Hoo

--
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 a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/jNpeO_FzZDg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Regards,

Chee Hoo

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