• Resolved drasleona

    (@drasleona)


    Hello,

    I’m using ACF Pro to create all of my meta data, but Elastic search seems not to recognize them.. Is there a way to add my meta data in the indexation ?

    Thx,

    Lola

Viewing 2 replies - 1 through 2 (of 2 total)
  • Chris

    (@lamordnt)

    I got this working for me by adding the following to my functions.php file. Just replace the custom_fields with your custom fields.

    /* Custom Fields to Return in the ElasticSearch Results */
    function my_search_filter($query) {
      if ( !is_admin() && $query->is_main_query() ) {
        if ($query->is_search) {
     	
    		$query->set('search_fields', array(
            'post_title',
            'meta' => array( 
            				        'custom_field_1',
    						'custom_field_2',
    						'custom_field_3',
    						'custom_field_4',
    						
    						)));
        }
      }
    }
    add_action('pre_get_posts','my_search_filter',1);
    Plugin Contributor vhauri

    (@vhauri)

    Per our pinned post on this support forum, we provide all support through Github. You can file issues at https://github.com/10up/ElasticPress.

    It seems this issue has been resolved, but if you have additional issues please feel free to file a Github ticket and we will respond.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I index fields ffrom ACF plug-in ?’ is closed to new replies.