Problem/Motivation

After updating to the latest search_api release 1.5 field mappings were never updated any more, leading to various hard to track down bugs. Previously this was already buggy during deployment, but with the 1.5 update this became a severe problem. Attached is a patch which fixes the problem for me.

To reproduce:

  1. Install and enable elasticsearch_connector 8.x-5.x-dev and search_api 8.x-1.5.
  2. Configure your Elasticsearch Server
  3. Create an index
  4. Add field mappings including a mix of Fulltext and String types
  5. Index data by running cron or by clicking Index Now on the Index Summary page (/admin/config/search/search-api/index/<index_machine_name>)
  6. Query the index details (curl http://localhost:9200/<name_of_index>. Notice that all fields get indexed as text types. Expected result is that only fields marked as Fulltext are text types in Drupal.

Proposed resolution

Fix it.

Remaining tasks

Review.

User interface changes

None

API changes

None.

Data model changes

None.

Comments

fago created an issue. See original summary.

fago’s picture

Status: Active » Needs review
StatusFileSize
new1.95 KB
m4olivei’s picture

Issue summary: View changes

I found this as well, via an odd facets bug:

https://www.drupal.org/node/2913535

I found that the only way to force the mapping to get set correctly was to, create your index, and your mapping, then hit the "Clear all indexed data" link no the Index Summary page (/admin/config/search/search-api/index/<index_machine_name>). Then either run cron or click Index now on the Index Summary page. The fields are then properly indexed, respecting the mapping that was setup.

Updated the issue summary.

m4olivei’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.81 KB

Didn't apply cleanly, so here's a re-roll against the latest 8.x-5.x. I'll also throw up a PR on Github.

This works for me though!

m4olivei’s picture

  • skek authored 64bf86c on 8.x-5.x
    Merge pull request #25 from m4olivei/2922635-elasticsearch-mapping...
  • m4olivei committed e235129 on 8.x-5.x
    Issue #2922635 by fago, m4olivei: Field mapping is never getting updated
    
skek’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for your work guys. The patch has been committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.