Copy_to create array of string

I'm using the copy_to in two fields: city_name andneighborhood_name for the full_data field, so I need to use a match_phrase_prefix, but that does not work.

I've set "store": true, in full_data and I noticed that full_data has an array of tokens, how can I convert an array to a string?

Example:

city_name = Campinas
neighborhood_name = Change

full_data = ['Cambui', 'Campinas']

{
  "tokens": [
     {
          "token": "cambui",
          "start_offset": 0,
          "end_offset": 6,
          "type": "word",
          "position": 0
    }
   {
          "token": "campinas",
          "start_offset": 7,
          "end_offset": 15,
          "type": "word",
          "position": 101
    }
  ]
}

but what I need is

{
  "tokens": [
     {
       "token": "cambui campinas",
       "start_offset": 0,
        "end_offset": 15,
        "type": "shingle",
        "position": 0
      }
   ]
}

and my query:

  {
      "match_phrase_prefix": {
           "full_data.shingle": {
                "query": "cambui campinas"     
           }
        }
   }

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