c# - SuggestCompletion Nest usage -


i'm trying suggestcompletion query location (countries , cities), i'd perform query on 2 fields.

my mapping far following:

var response =  _client.createindex(platformconfiguration.locationindexname,                     descriptor => descriptor.addmapping<locationinfo>(                         m => m.properties(                             p => p.completion(s => s                                 .name(n=>n.countryname)                                 .indexanalyzer("simple")                                 .searchanalyzer("simple")                                 .maxinputlength(50)                                 .payloads()                                 .preserveseparators()                                 .preservepositionincrements()).                                 completion(s=>s.name(n => n.city)                                 .indexanalyzer("simple")                                 .searchanalyzer("simple")                                 .maxinputlength(50)                                 .payloads()                                 .preserveseparators()                                 .preservepositionincrements())                             ))); 

edit: how i'm indexing elements:

public bool indexlocations(ilist<locationinfo> locations)          {             var bulkparams = locations.select(p => new bulkparameters<locationinfo>(p){                 id = p.id,                  timestamp = datetime.now.totimestamp()             });             var response = _client.indexmany(bulkparams, platformconfiguration.locationindexname);             return response.isvalid;         } 

edit

after viewing mappings changed query following:

var response = _client.search<locationinfo>(location =>                 location.index(platformconfiguration.locationindexname).                     suggestcompletion("locationinfo", f => f.onfield("countryname").text(text).size(1))); 

and tried:

 var response = _client.search<locationinfo>(location =>                 location.index(platformconfiguration.locationindexname).                     suggestcompletion("countryname", f => f.onfield("countryname").text(text).size(1)));   

.....and still empty result

the mapping

{   "locationindex": {     "mappings": {       "locationinfo": {         "properties": {           "countryname": {             "type": "completion",             "analyzer": "simple",             "payloads": true,             "preserve_separators": true,             "preserve_position_increments": true,             "max_input_length": 50           }         }       },       "bulkparameters`1": {         "properties": {           "document": {             "properties": {               "city": {                 "type": "string"               },               "countryname": {                 "type": "string"               },               "countrytwodigitcode": {                 "type": "string"               },               "id": {                 "type": "string"               },               "latitude": {                 "type": "string"               },               "longitude": {                 "type": "string"               }             }           },           "id": {             "type": "string"           },           "timestamp": {             "type": "long"           },           "versiontype": {             "type": "long"           }         }       }     }   } } 

the support indexmany() wrapped bulkparameters has been removed in nest 1.0.0 beta 1

if want use bulk more advanced parameters have use bulk() command.

the beta sadly still shipped bulkparameters class in assembly

this has since been removed in develop branch.

so happens indexing "bulkparameters``1``" type documents , not "locationinfo". mapping specified "locationinfo" not come play.

see here example on how use bulk() index many objects @ once while configuring advanced parameters individual items.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -