Porting _all field when migrating from ES 1.7.5 to 7.4

Hi all

I am in the process of migrating following mapping in ES 1.7.5 to 7.4:

name:
  type: 'string'
  index: 'analyzed'
  include_in_all: true
  fields:
    name_bm25:
      type: 'string'
      index: 'analyzed'
      analyzer: 'english_custom_stems'
      similarity: 'BM25'
      include_in_all: true

as you could see above, I have multi-field name_bm25 of which values is also added to _all field (NOTE: I use include_in_all: true)

So when I migrate to ES 7.x, I was forced to create a new field _all because this field feature is no longer available. Below is my new mapping:

_all:
  type: 'text'
  store: false

name:
  type: 'text'
  copy_to: '_all'
  fields:
    name_bm25:
      type: 'text'
      analyzer: 'english_custom_stems'
      similarity: 'BM25'
      copy_to: '_all' # <= this is not working

I use copy_to to copy field values to _all field which works with name field however the copy_to does not work with term (results after analysis) of multi-field name.name_bm25.

I would like to ask if I want to copy the analysed value of name.name_bm25 to _all, what should I do? OR do I have to do it? (in the case if I misunderstand the copy_all).

So seems to me one solution is to add a new name_bm25 field with analysed field value (either manually or taking advantage of _analyze API), for example:

_all:
  type: 'text'
  store: false

name_bm25: # NOTE: field value must be analysed in advance
  type: 'text'
  copy_to: '_all'

name:
  type: 'text'
  copy_to: '_all'
  fields:
    name_bm25:
      type: 'text'
      analyzer: 'english_custom_stems'
      similarity: 'BM25'

I don't think it is the right approach as it does not feel right to do that manually.

Any help is greatly appreciated. Thanks much in advance

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.