Spring data elasticsearch query products with multiple fields -


es newbie here, sorry dumb question.

i have been trying create elasticsearch query products index. i'm able query it, never returns expect.

i'm using query builder in wrong way, have tried sorts of queries builders , never got make work expected.

my product class (simpler sake of question):

public class product {      private string sku;      private boolean soldout;      private boolean freeshipping;      private store store;      private category category;      private set<producturl> urls;      private set<productname> names;  } 

category nas name , id use aggregations

the boolean field used filters.

productname , producturl both have string locale , string name or string url accordingly

i building query following logic

private searchquery buildsearchquery(string searchterm, list<long> categories, pageable pageable) {     nativesearchquerybuilder builder = new nativesearchquerybuilder();     if (searchterm != null) {         builder.withquery(                 new multimatchquerybuilder(searchterm, "names.name", "urls.url", "descriptions.description", "sku")                         .operator(operator.and)                         .type(multimatchquerybuilder.type.most_fields)         );     }     builder.withpageable(pageable);     return builder.build(); } 

the problem lots of products not being matched, example:

query "andro" not return "android" products.

what missing? way of building query right?

update adding names part of product mapping:

    {     "mappings": {         "product": {             "properties": {                 "names": {                     "properties": {                         "id": {                             "type": "long"                         },                         "name": {                             "type": "string"                         },                         "locale": {                             "type": "string"                         }                     }                 }             }         }     } } 


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -