Re: Search for parts of a string array in elasticsearch
This will be the equivalent API.. boolQueryBuilder.must(QueryBuilders.termsQuery("field", "value1","value2","value3").minimumMatch(3)); On Friday, June 12, 2015 at 6:02:31 PM UTC+5:30, Muddadi Hemaanusha wrote: > > Hi, > > You can use terms query to match N number of values in field in different > documents by, > > { > "terms" : { > "field" : [ "value1", "value2", "value3" ], > "minimum_should_match" : 3 > }} > > Here you can specify minimum should match, > if you want only only value matched docs then 1 or else to match all the > values matched docs keep as 3 or else only 2 values then keep 2. > > > > On Wednesday, June 10, 2015 at 1:31:54 PM UTC+5:30, Vipin Sudhakar wrote: >> >> Hi, >> >> I have a requirement, where i have to search for the filed >> values(value1,value2 and value3) from elasticsearch. >> >> But these values will be available from three differetn documents. >> >> How can i make a ES query? >> >> Currently i have single value for the filed and the query goes as below; >> >> boolQueryBuilder.must(QueryBuilders.matchQuery(fieldName, >> value); >> >> How shud i modify the query to suppor the array of string values >> selection. >> >> Thanks, >> Sumitha. >> >> >> >> >> -- >> View this message in context: >> http://elasticsearch-users.115913.n3.nabble.com/Search-for-parts-of-a-string-array-in-elasticsearch-tp4075074.html >> >> Sent from the Elasticsearch Users mailing list archive at Nabble.com. >> > -- Please update your bookmarks! We have moved to https://discuss.elastic.co/ --- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/fecfa130-7d2a-492d-b86e-9c782d8f40ef%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Search for parts of a string array in elasticsearch
Hi, You can use terms query to match N number of values in field in different documents by, { "terms" : { "field" : [ "value1", "value2", "value3" ], "minimum_should_match" : 3 }} Here you can specify minimum should match, if you want only only value matched docs then 1 or else to match all the values matched docs keep as 3 or else only 2 values then keep 2. On Wednesday, June 10, 2015 at 1:31:54 PM UTC+5:30, Vipin Sudhakar wrote: > > Hi, > > I have a requirement, where i have to search for the filed > values(value1,value2 and value3) from elasticsearch. > > But these values will be available from three differetn documents. > > How can i make a ES query? > > Currently i have single value for the filed and the query goes as below; > > boolQueryBuilder.must(QueryBuilders.matchQuery(fieldName, >value); > > How shud i modify the query to suppor the array of string values > selection. > > Thanks, > Sumitha. > > > > > -- > View this message in context: > http://elasticsearch-users.115913.n3.nabble.com/Search-for-parts-of-a-string-array-in-elasticsearch-tp4075074.html > > Sent from the Elasticsearch Users mailing list archive at Nabble.com. > -- Please update your bookmarks! We have moved to https://discuss.elastic.co/ --- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/78cd197d-d1cf-4891-a2b2-456aec1d8f1e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Search for parts of a string array in elasticsearch
Hi, I have a requirement, where i have to search for the filed values(value1,value2 and value3) from elasticsearch. But these values will be available from three differetn documents. How can i make a ES query? Currently i have single value for the filed and the query goes as below; boolQueryBuilder.must(QueryBuilders.matchQuery(fieldName, value); How shud i modify the query to suppor the array of string values selection. Thanks, Sumitha. -- View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Search-for-parts-of-a-string-array-in-elasticsearch-tp4075074.html Sent from the Elasticsearch Users mailing list archive at Nabble.com. -- Please update your bookmarks! We have moved to https://discuss.elastic.co/ --- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1433923300550-4075074.post%40n3.nabble.com. For more options, visit https://groups.google.com/d/optout.