Hi all,

So to begin. I am trying to add around 7.2k documents. No problem there. 
The issue is after I am not able to get any suggestions returned to me. So 
this is how the information is added:


 def addVariantToElasticSearch(self,docId, companyId, companyName, 
parent,companyIndustry
, variants, count, conn):
    body = { "company":{
                 "company_name": companyName,
                 "parent": parent,
                 "suggest": {   "input": variants,
                                "output": companyName,
                                "weight": count,
                                "payload": {"industry_id": companyIndustry, 
                                            "no_of_jobseekers":count,
                                            "company_id": companyId
                                           } 
                             }
                         }
            }
 res = conn.index(body=body, index="companies", doc_type="company", id=docId
)


The mapping and settings is defined as:

def setting():
 return { "settings" : {
                "index": {
                   "number_of_replicas" : 0,
                   "number_of_shards": 1
            },
            "analysis" : {
                "analyzer" : {
                    "my_edge_ngram_analyzer" : {
                        "tokenizer" : "my_edge_ngram_tokenizer",
                        "filter":["standard", "lowercase"]
                    }
                },
                "tokenizer" : {
                    "my_edge_ngram_tokenizer" : {
                        "type" : "edgeNGram",
                        "min_gram" : "1",
                        "max_gram" : "5",
                        "token_chars": [ "letter", "digit" ]
                    }
                }
            }
        },
        "mappings": {
                "company" : {
                  "properties" : {
                        "name" : { "type" : "string" },
                        "industy": {"type": "integer"},
                        "count" : {"type": "long" },
                        "parent": {"type": "string"},
                        "suggest" : {
                          "type" :     "completion",
                          "index_analyzer": "my_edge_ngram_analyzer",
                          "search_analyzer": "my_edge_ngram_analyzer",
                          "payloads": True
                        }
                  }
                }
          }
    }

Index creation:

def createMapping(es):
      settings = setting()
      es.indices.create(index="companies", body=settings)


I call `createMapping` which uses `setting()`, then add each variant - 
surrounded by a try,except -> causes no issue. I can see all my documents 
added in the browser as well as looking at the status, settings and 
mappings. 

But when I use a curl request as below, I get no results. (See curl and 
output beneath)

curl -X POST localhost:9200/companies/_suggest -d '

{ 

 "company-suggest" : { 

    "text" : "1800", 

"completion" : { 

quote>       "field" : "suggest" 

quote>     } 

quote>   } 

quote> }'



-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/f866147a-242b-4488-966c-c2d1d405269e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to