opendistro-for-elasticsearch / k-NN

🆕 A machine learning plugin which supports an approximate k-NN search algorithm for Open Distro.
https://opendistro.github.io/
Apache License 2.0
277 stars 55 forks source link

suggest is not a SuggestField #227

Closed paintmeyellow closed 3 years ago

paintmeyellow commented 4 years ago

Why when I am using "index.knn = true" I got error suggest is not a SuggestField?

Here is the mapping of suggest field:

"suggest": {
    "type": "completion",
    "analyzer": "simple",
    "preserve_separators": true,
    "preserve_position_increments": false,
    "max_input_length": 50
}

Here is the problem part of query:

"suggest": {
    "prefix_suggest": {
        "text": "white",
        "completion": {
            "field": "suggest"
        }
    }
}
vamshin commented 4 years ago

Hi @Nikitos096,

Could you please provide the complete index mapping and the query to reproduce at our end?

paintmeyellow commented 4 years ago

Hi @Nikitos096,

Could you please provide the complete index mapping and the query to reproduce at our end?

Yep, here you go:

PUT music
{
  "settings": {
    "index": {
      "knn": true
    }
  }, 
  "mappings": {
    "properties": {
      "suggest": {
        "type": "completion"
      }
    }
  }
}

PUT music/_doc/1?refresh
{
  "suggest" : {
    "input": [ "Nevermind", "Nirvana" ],
    "weight" : 34
  }
}

POST music/_search?pretty
{
  "suggest": {
    "song-suggest": {
      "prefix": "nir",        
      "completion": {         
          "field": "suggest"  
      }
    }
  }
}

Source: https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-suggesters.html#completion-suggester

vamshin commented 4 years ago

Looks like KNNCodec is missing this implementation. Will dig into this and update the thread soon.

vamshin commented 4 years ago

We are considering this as a bug and we would prioritize the fix accordingly.