Search by newly added wildcard field to existing index

I have in mappings

"fooField": {
          "type": "double"
        }

I want to search by this field using wildcard query, so I added wildcard multifield

"fooField": {
          "type": "double",
          "fields": {
            "wildcard": {
              "type": "wildcard"
            }
          }
        }

Searching by this field using the following query does not work until I execute _update_by_query pipeline (to set the same value again what fixes searching by wildcard)

{
  "query": {
    "wildcard": {
      "fooField.wildcard": {
        "wildcard": "*150.23*",
        "boost": 1.0
      }
    }
  }
}

Create pipeline

PUT _ingest/pipeline/test-pipeline
{
  "processors": [
    {
      "set": {
        "field": "fooField",
        "value": "{{{fooField}}}",
        "ignore_empty_value": true
      }
    }
  ]
}

Call pipeline

POST some-index/_update_by_query?pipeline=test-pipeline&conflicts=proceed
{
    "query": {
        "match_all": {}
    }
}

Is this correct approach to such scenario?

I see no problem with your approach. It's working for you and without any flaws.

Another option is to reindex the entire index in a new one. You would have 2 indexes and if the new one has some unexpected behavior you can go back to the old one. If everything is ok, you can remove the old one and use the new index.

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