elasticsearch完成字段中的权重值

kninwzqo  于 2021-06-15  发布在  ElasticSearch
关注(0)|答案(0)|浏览(186)

我有一个完成字段Map如下:

"multi_field_suggest": {
          "type": "completion",
          "analyzer": "standard",
          "preserve_separators": true,
          "preserve_position_increments": true,
          "max_input_length": 50
        },

该字段值如下所示:

{
  "input": [
    "106-93-4",
    "1,2-Dibromoethane",
    "1,2-Ethylene dibromide",
    "EDB",
    "Ethylene dibromide",
    "alpha,beta-Dibromoethane",
    "Ethane, 1,2-dibromo-"
  ],
  "weight": 20
}

我要做的是给每一个都称重。医生认为这是可能的(https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-suggesters-completion.html),我想要实现的是:

[
  {
    "input": "1,2-Dibromoethane",
    "weight": 20
  },
  {
    "input": "1,2-Ethylene dibromide",
    "weight": 21
  }
]

When I set up this data structure in my indexer code and try to index, I get this error:

**failed to parse. input array must have string values, but was [START_OBJECT]**

Do I need to change my mapping?  Is there something else going on here?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题