As part of my content I have 3 sets of Taxonomy terms. When I add them as fields and then index my results through Search API it passes the integer value for the term. Is there any way to pass the label instead? So if term "7" was part of terms "color" can I return the value of "Green" instead of the "7" to Elasticsearch somehow? I realize this probably isn't a super common use case, but I'm running a decoupled front end and this would make things go much smoother.
I hope this makes sense. Sorry if I'm missing something super easy. Thanks for the wonderful module.
If this doesn't work for whatever reason I can use a select list instead, but Taxonomy terms seem easier to scale for other sections of this particular project. So it would be super helpful to get this figured out. Thanks!
Comments
Comment #2
mparker17@shawnmatthews, I'm sorry for how long it has taken someone to answer your support request.
Supported versions of Elasticsearch Connector use the Search API module to define what gets stored in the index (i.e.: what search queries match against), and also what gets displayed on the in the search results page.
When you're adding fields to be indexed, you should see an "Expand" button next to reference fields (like taxonomy term reference fields). If you click that button, you can see the fields on the taxonomy terms that can be referenced by that field; and you should see a "Name" sub-field there ("Name" is the default label for taxonomy terms' Label (Title) field). For example, on my test site, nodes have a "field_terms" taxonomy reference field, so the "Name" sub-field has the machine name
field_tags:entity:name). If you click the "Add" button for that sub-field, then the taxonomy term's Name/Title/Label is stored in Elasticsearch's index (i.e.: and search queries can match against it).If you're using views to set up a search results page, and you've indexed the Name sub-field as described in the previous paragraph, look for a field that ends with "Name (indexed field)" in the "Content datasource" field (on my test site, the field had the full name "Tags » Taxonomy term » Name (indexed field)").
If you need something more sophisticated, and you're willing to write and maintain custom code, Search API and Elasticsearch Connector allow you to alter search results before they're displayed - for example Search API's ProcessingResultsEvent and/or Search API Processor plugins are able to modify search results returned by the index.