java - Is it possible to using in elasticsearch spring data query IN like in MySQL? -


i need using query in in mysql question "is possible" ? try find in googl`e out result. if possible how should ?

maybe use clousure should? how in elasticsearch spring data should use?

my code:

transactionindexrepository:

public interface transactionindexrepository extends elasticsearchrepository<transindex, string> {      list<transindex> findbysellerin(string sellers);  } 

transactionquerycontroller:

@restcontroller public class transactionquerycontroller {       private transactionindexrepository transactionindexrepository;     private transactionservice transactionservice;      @autowired     public transactionquerycontroller(transactionservice transactionservice) {         this.transactionservice = transactionservice;     }      @requestmapping(value = "/transaction/search", produces = mediatype.application_json_value)     private map search(             @requestparam(value = "commenttext", required = false) string commenttext,             @requestparam(value = "commenttype", required = false) long commenttype,             @requestparam(value = "title", required = false) string title,             @requestparam(value = "pricefrom", required = false) long pricefrom,             @requestparam(value = "priceto", required = false) long priceto,             @requestparam(value = "tsfrom", required = false) long tsfrom,             @requestparam(value = "tsto", required = false) long tsto,             @requestparam(value = "seller", required = false) long seller,             @requestparam(value = "item", required = false) long item,             @requestparam(value = "tree_cat", required = false) long tree_cat,             @requestparam(value = "buyer", required = false) long buyer,             @requestparam(value = "cat", required = false) long cat,             @requestparam(value = "sellers", required = false) string sellers,             pageable pageable) {            system.out.println(transactionindexrepository.findbysellerin(sellers));           final transindexsearchparams searchparams = transindexsearchparams.builder()                 .commenttext(commenttext)                 .commenttype(commenttype)                 .title(title)                 .pricefrom(pricefrom)                 .priceto(priceto)                 .tsfrom(tsfrom)                 .tsto(tsto)                 .seller(seller)                 .item(item)                 .tree_cat(tree_cat)                 .buyer(buyer)                 .cat(cat)                 .build();          return transactionservice.searchbyindexparams(searchparams, pageable);     }  } 

and i`v got error:

servlet.service() servlet [dispatcherservlet] in context path [] threw exception [request processing failed; nested exception java.lang.nullpointerexception] root cause 

whats wrong?

in repository class, can define findbyxyzin() query method takes collection of strings, this:

findbynamein(collection<string> names); 

the equivalent dsl query going generated this:

{   "bool": {     "must": {       "bool": {         "should": [           {             "field": {               "name": "name1"             }           },           {             "field": {               "name": "name2"             }           }         ]       }     }   } } 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -