elasticsearch完成字段中的权重值

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

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

  1. "multi_field_suggest": {
  2. "type": "completion",
  3. "analyzer": "standard",
  4. "preserve_separators": true,
  5. "preserve_position_increments": true,
  6. "max_input_length": 50
  7. },

该字段值如下所示:

  1. {
  2. "input": [
  3. "106-93-4",
  4. "1,2-Dibromoethane",
  5. "1,2-Ethylene dibromide",
  6. "EDB",
  7. "Ethylene dibromide",
  8. "alpha,beta-Dibromoethane",
  9. "Ethane, 1,2-dibromo-"
  10. ],
  11. "weight": 20
  12. }

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

  1. [
  2. {
  3. "input": "1,2-Dibromoethane",
  4. "weight": 20
  5. },
  6. {
  7. "input": "1,2-Ethylene dibromide",
  8. "weight": 21
  9. }
  10. ]
  11. When I set up this data structure in my indexer code and try to index, I get this error:
  12. **failed to parse. input array must have string values, but was [START_OBJECT]**
  13. Do I need to change my mapping? Is there something else going on here?

暂无答案!

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

相关问题