NEST/Elasticsearch.Net version: 7.11.1
Elasticsearch version: 7.11.1
Description of the problem including expected versus actual behavior:
I have an index with a text field with IndexPhrases enabled. The entity has a List"bad", "Prio 1" I get an error which wasn't there in the 7.10 version.
Steps to reproduce:
Execute the following unit test
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Elasticsearch.Net;
using Nest;
using Xunit;
namespace ElasticError
{
public class MyTest
{
[Fact]
public async Task TestRaw()
{
var indexName = $"{ Guid.NewGuid()}";
var connectionPool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var connectionSettings = new ConnectionSettings(connectionPool)
.DefaultMappingFor<ElasticTestIndexEntry>(m => m
.IndexName(indexName)
)
.EnableDebugMode()
.DisableDirectStreaming();
var client = new ElasticClient(connectionSettings);
try
{
var entry = new ElasticTestIndexEntry()
{
Tags = new List<string>() {
"bad",
"Prio 1"
},
};
await client.Indices.CreateAsync(indexName, c => c
.Map<ElasticTestIndexEntry>(s => s
.AutoMap()
.Properties(p => p
.Text(t => t
.Name(e => e.Tags)
.IndexPhrases()
)
)
)
);
var bulkEntry = new BulkDescriptor();
bulkEntry.Refresh(Refresh.True);
bulkEntry.Index<ElasticTestIndexEntry>(i => i.Document(entry));
var bulkResponse = await client.BulkAsync(bulkEntry);
if (bulkResponse.Errors)
throw new Exception(bulkResponse.DebugInformation);
}
finally
{
await client.Indices.DeleteAsync(indexName);
}
}
public class ElasticTestIndexEntry
{
public List<string> Tags { get; set; }
}
}
}
Expected behavior
The document is created without an error.
Provide ConnectionSettings (if relevant):
Provide DebugInformation (if relevant):
ElasticError.MyTest.TestRaw
Source: TestIndexTest.cs line 13
Duration: 1 sec
Message:
System.Exception : Invalid NEST response built from a successful (200) low level call on POST: /_bulk?pretty=true&error_trace=true&refresh=true
# Invalid Bulk items:
operation[0]: index returned 400 _index: cb100c98-0899-4841-ab37-f1237799142e _type: _doc _id: mVr6_ncBR5uDxQ8nh-cX _version: 0 error: Type: illegal_argument_exception Reason: "position overflowed Integer.MAX_VALUE (got posIncr=1 lastPosition=0 position=-1) for field 'tags._index_phrase'"
# Audit trail of this API call:
- [1] HealthyResponse: Node: http://localhost:9200/ Took: 00:00:00.1895416
# Request:
{"index":{"_id":null,"_index":"cb100c98-0899-4841-ab37-f1237799142e"}}
{"tags":["bad","Prio 1"]}
# Response:
{
"took" : 133,
"errors" : true,
"items" : [
{
"index" : {
"_index" : "cb100c98-0899-4841-ab37-f1237799142e",
"_type" : "_doc",
"_id" : "mVr6_ncBR5uDxQ8nh-cX",
"status" : 400,
"error" : {
"type" : "illegal_argument_exception",
"reason" : "position overflowed Integer.MAX_VALUE (got posIncr=1 lastPosition=0 position=-1) for field 'tags._index_phrase'"
}
}
}
]
}
# TCP states:
TimeWait: 9
Established: 61
# ThreadPool statistics:
Worker:
Busy: 2
Free: 32765
Min: 8
Max: 32767
IOCP:
Busy: 0
Free: 1000
Min: 8
Max: 1000
Thanks for the detailed repro @MartinDemberger. I don't believe we consciously changed anything which should have changed the client behaviour around this between 7.1 and 7.11. I'll pick this up next week to investigate further.
Thanks again for reporting this @MartinDemberger. After reviewing it this morning, it appears to be a bug on the server so I've raised an issue for it to be tracked and addressed there. I'll close this issue as I don't believe this requires any client changes.
Most helpful comment
Thanks again for reporting this @MartinDemberger. After reviewing it this morning, it appears to be a bug on the server so I've raised an issue for it to be tracked and addressed there. I'll close this issue as I don't believe this requires any client changes.