Wonach suchst Du?
What are you looking for?

Check Elasticsearch index and add records to FTS (Troubleshooting)


A name (e.g., business partner) is recorded in a table and also shows in the list view, but when searching/filtering for it, it isn’t found.

Solution (Troubleshooting)

  1. Identify the business partner entry by finding its ID, e.g. C_BPartner_ID=3296013.
  2. Check c_bpartner_adv_search and retrieve the Elasticsearch document ID.

     select c_bpartner_id, es_documentid, created, updated, * from c_bpartner_adv_search where c_bpartner_id=3296013;

    A possible result could look like this:

    c_bpartner_id es_documentid created updated
    3296013 3296013-3360717-X 2018-04-14 07:22:23.000000 +01:00 2021-04-10 20:21:55.000000 +01:00
    3296013 3296013-3370769-3471263 2018-04-14 07:22:23.000000 +01:00 2021-04-10 20:21:55.000000 +01:00
  3. Check if a given document ID is indexed on Elasticsearch.

     GET http://localhost:19200/fts_bpartner/_doc/3296013-3360717-X
  4. Check how many documents are in that Elasticsearch index.

     GET http://localhost:19200/fts_bpartner/_count
  5. Check for the record ID in the Elasticsearch index queue.

     select * from ES_FTS_Index_Queue where record_id=3296013;
  6. Add all missing records (e.g., business partners) to the Elasticsearch index.

     INSERT INTO es_fts_index_queue (es_fts_config_id, eventtype, ad_table_id, record_id)
     SELECT (SELECT es_fts_config_id FROM es_fts_config WHERE es_index = 'fts_bpartner') AS es_fts_config_id,
            'U'                                                                          AS eventtype,
            get_table_id('C_BPartner')                                                   AS ad_table_id,
            bp.c_bpartner_id                                                             AS record_id
     FROM c_bpartner bp
     ORDER BY bp.c_bpartner_id
  7. Check the indexing progress.

     select processed, count(1) from ES_FTS_Index_Queue group by rollup (processed);

Note for Developers

If the Elasticsearch is buried somewhere deep in a docker container and it’s not accessible from the outside, then you have to create an SSH tunnel and map the Elasticsearch standard port 9200 to your localhost port 19200, e.g.:

putty elasticsearch-host -L 19200:search:9200

View source file on GitHub.com