2

my first SO post ! I'm trying to set a Stempel Analyzer (ES analyzer for polish language) for a string field. I can do it through PUT request:

{
   "doc": {
      "_source": {
         "enabled": false
      },
      "properties": {
         "file": {
            "type": "attachment",
            **"analyzer": "polish"**,
            "fields": {
               "content": {
                  "type": "string",
                  "term_vector": "with_positions_offsets"
               }
            }
         }
      }
   }
}

and it works fine. Trying to do the same thing through NEST.

 [ElasticProperty(Name = "_content", TermVector = TermVectorOption.WithPositionsOffsets, Analyzer = "polish")]
 public string Content { get; set; }

is not working neither do:

            client.CreateIndex(index, b => b.AddMapping<DocInES>(m => m
            .MapFromAttributes()
            .Properties(props => props
                .String(s => s
                    .Name(p => p.File.Content)
                    .Analyzer("polish")
                     ))));

When I'm using

var result = client.Analyze(a => a.Index("doc").Analyzer("polish").Text("...text..."));

It works fine, so .NET is detecting this analyzer. I'm using ES 2.1.1. & NEST 1.7.1

EDIT: from what I inspected it seems that NEST is not doing Mapping of Attributes of Attachment class created in .NET. It does Map Attributes of Document class

[ElasticType(Name = "docInES")]
public class DocInES {
    public int InstitutionId { get; set;}
    public int DocumentId { get; set; }
    [ElasticProperty(Store = true, Analyzer = "polish")]
    public string Title { get; set; }

    [ElasticProperty(Type = FieldType.Attachment)]
    public Attachment File { get; set; }

}

But not the Attachment class:

public class Attachment {
    [ElasticProperty(Name = "content2", Store = true)]
    public string Content { get; set; }

    [ElasticProperty(Name = "content_type2")]
    public string ContentType { get; set; }

    [ElasticProperty(Name = "name2", Analyzer = "english")]
    public string Name { get; set; }
}
Rob
  • 9,664
  • 3
  • 41
  • 43
Leszek ABC
  • 23
  • 5

1 Answers1

0

You should probably check the compatibility matrix on Github.

Nest 1.7.1 is not compatible with ES 2.1.1

Selcuk S.
  • 661
  • 2
  • 9
  • 19