-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Bug: Indexing documents for suggestions results in exceptions.
Elasticsearch version : 5.3
Plugins installed: None.
JVM version (java -version): 1.8.X
OS version Windows.
Description of the problem including expected versus actual behavior:
Expected normal indexing - It does index the documents in the end.
However it throws exceptions in Lucene and I'm not sure how it affects the JVM and elastic.
The exception:
IlegalArgumentException value must have a length > 0.
(SuggestField- Ctor)
Steps to reproduce:
Create an index with a Completion type. (Simple analyzer).
Mapping looks like this:
{
"mappings":{
"myType":{
"properties":{
"suggest":{
"type": "completion"
}
}
}
}
}
Index a document:
Post request:
{
'suggest': {
'input': ['One', 'Two']
}
}
Using a bulk request:
{ 'create': { '_index':'myIndex' , '_type':'myType', '_id': '0'}}
{'suggest' : { 'input': ['One','Two'] } }
I use the C# nest api with a SuggestRequest. (as stated in the docs:
https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/suggest-usage.html )
Related stackoverflow topic:
https://stackoverflow.com/questions/48193721/empty-value-generates-mapper-parsing-exception-for-elasticsearch-completion-sugg
So I've followed the stack trace to reach into 2 pages:
The SuggestField in Lucene which throws:
https://github.com/apache/lucene-solr/blob/master/lucene/suggest/src/java/org/apache/lucene/search/suggest/document/SuggestField.java
Line: 89
And the code in elastic:
https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/index/mapper/CompletionFieldMapper.java
Line 465
The indexing method was by your docs:
https://www.elastic.co/guide/en/elasticsearch/reference/5.3/search-suggesters-completion.html
I tried different ways of tackling it with no luck.
I enursed the data I send is not empty (Has values and the array is not empty).
Thanks!