ERROR 1064 (42000): unknown local index(es) in search request

Please help! I am currently using Manticore 3.4.2 in ubuntu/bionic64

I have distributed, template and plain indexes. All of them passed indextool --check. indextool --checkconfig also passed. indexer --rotate --all --sighup-each also successful.

But upon entering mysql -h0 -P9306 to select from the indexes, I got an error saying ERROR 1064 (42000): unknown local index(es) *index_name* in search request

What do you think is wrong?

seems there is no such index at your daemon. Could you check the output of SHOW tables SphinxQL statement?

only the template indexes were returned.

then you need to look at your searchd.log and figure our why all other indexes were not loaded

Did you manage to fix this issue? I’m having the same issue, created indexes successfully but can’t find the index when searching.

@Hadi_Sharghi pls show your searchd log

I can only assume that you started the searchd with no indexes, then updated the config file and built the index (indexer w/o --rotate). In this case to make the index appear in the searchd you can:

  • rebuild the index with indexer --rotate
  • call RELOAD INDEXES via the sql interface
  • restart the searchd

I have a similar issue. Search via mysql-client just don’t work until I prompt RELOAD INDEXES.

I updated the index before using docker exec -it manticore gosu manticore indexer --all --rotate

How to fix this?

@Elle_Driver Can you provide a complete instruction how to reproduce it?

I got this issue when I use Docker, but don’t mount a /var/lib/manticore dir to the host. Then the search daemon after starting tries to read the index defined in the configuration file, but it does not yet exist. I got this record in the log: [Thu Feb 11 13:32:22.511 2021] [19] WARNING: index 'messages_index': prealloc: failed to open /var/lib/manticore/messages_index.sph: No such file or directory - NOT SERVING.

If I mount the /var/lib/manticore dir to the host, the search daemon will read the index after the SECOND launch and search queries will work.

This is my config file. Variables are replaced in the Dockerfile.

source ${SPHINX_INDEX_NAME}_source {
    type                = ${DATABASE_TYPE_SPHINX}
    sql_host            = ${MYSQL_HOST_SPHINX}
    sql_port            = ${MYSQL_INTERNAL_PORT}
    sql_db              = ${MYSQL_DATABASE_SPHINX}
    sql_user            = ${MYSQL_USERNAME_SPHINX}
    sql_pass            = ${MYSQL_PASSWORD_SPHINX}

    sql_query_pre       = SET NAMES utf8mb4
    sql_query_pre       = SET CHARACTER_SET_RESULTS=utf8mb4
    sql_query           = SELECT * FROM messages

    sql_field_string    = message
    sql_attr_bigint     = id
    sql_attr_string     = source
    sql_attr_string     = origin
    sql_attr_timestamp  = posted_at

    type                = plain
    source              = ${SPHINX_INDEX_NAME}_source
    path                = /var/lib/manticore/${SPHINX_INDEX_NAME}

searchd {
    listen = ${SPHINX_INTERNAL_PORT}:mysql41

    log = /var/log/manticore/searchd.log
    query_log = /var/log/manticore/query.log
    query_log_mode = 666

    binlog_path = # disable logging

    pid_file = /var/run/manticore/

When I run the docker exec -it manticore gosu manticore indexer --all --rotate command, I get the message WARNING: nothing to rotate after SIGHUP in the log, but all files as like as .spa, .spb, .spd, etc. are created. Search requests don’t work: ERROR 1064 (42000): unknown local index(es) 'messages_index' in search request

But after the second launch of the Docker container, search requests begin to work.

It’s ok since:

  • when you run Manticore with a config which refers to a plain index which doesn’t exist yet it just skips it (and says “No such file or directory - NOT SERVING”)
  • then when you build your index by indexer it makes the index files and (since you use --rotate) sends a signal to Manticore to rotate the index, but since Manticore doesn’t know about it yet it does nothing
  • then when you restart Manticore it already sees the index files and loads the index normally

Alternatively instead of restarting it (“second launch of the Docker container”)) you can call RELOAD INDEXES SQL command to force Manticore re-read the config, check if either of the indexes already have files and start using them.