1
def createCompanyAutoCompleteIndex(indexName: String, host: String, port: Int = defaultPort,  shds: Int = defaultShards): Unit = {
    client(host, port).execute {
      createIndex(indexName).shards(shds).mappings {
        mapping(mappingName).as(
          keywordField("id"),
          textField("name_suggest").analyzer("autocomplete").searchAnalyzer("autocomplete_search"),
          keywordField("name"),
          longField("number_of_employees"),
          **longField("net_sales"),**
          intField("company_type_score")
        )
      }.analysis(
        Seq(CustomAnalyzerDefinition("autocomplete",EdgeNGramTokenizer("autocomplete", 2, 10, Seq("letter")), LowercaseTokenFilter),
        CustomAnalyzerDefinition("autocomplete_search", LowercaseTokenizer)))
    }.await
  }

I don't see a rank feature field option, I want to make net sales of type Rank Feature, pls help !!

Nensi Kasundra
  • 1,980
  • 6
  • 21
  • 34

1 Answers1

0

There's a RankFeatureField case class located under the com.sksamuel.elastic4s.fields package: https://github.com/sksamuel/elastic4s/blob/7154d10e0097cebe5524875f88f6a81f03bb3b26/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/fields/RankFeatureField.scala

There's no helper constructor methods (in camelCase, e.g. intField) but you should be able to use the case class (in PascalCase) directly.

yangzai
  • 962
  • 5
  • 11