0

i put the custom analyzer through POSTMAN..

    {
    "settings": {
        "index": {
            "number_of_shards": "3",
            "number_of_replicas": "1"
        },
        "analysis" : {
          "analyzer" : {
            "ilhee_Custom" : {
                "tokenizer" : "whitespace",
                "filter" : ["lowercase", "my_stoplist", "snowball", "word_delimiter"]
                }
            },
        "filter" : {
            "my_stoplist" : {
                "type" : "stop",
                "stopwords_path" : "stopword_list.txt",
                "remove_trailing" : true
                }
            }
        }
    },
    "mappings": {
        "mc": {
            "properties": {
                "id": {
                    "type": "long"
                },
                "code": {
                    "type": "string"
                },
                "mainclass": {
                    "type": "string",
                    "analyzer": "ilhee_Custom"
                }
            }
        }
    }
}

i would like to change the code to plain elasticsearch (C# code).. this is my current code status... I really want add custom filte " my_stoplist filter... custom stop word list" but.. i don't know how can i change any more ..

private static string BuildCompanyMapping()
    {
        return new PlainElastic.Net.Mappings.MapBuilder<mc>()
            .RootObject(typeName: "mc",
                        map: r => r
                .All(a => a.Enabled(false))
                .Dynamic(false)
                .Properties(pr => pr
                    .String(mc => mc.mainclass, f => f.Analyzer(DefaultAnalyzers.snowball))
                    .String(mc => mc.code, f => f.Analyzer(DefaultAnalyzers.whitespace))
                    .Number(mc => mc.id, null)
                )
          )
          .BuildBeautified();

    }
    private static string BuildIndexSettings()
    {
        return new IndexSettingsBuilder()
            .Analysis(als => als
                .Analyzer(a => a
                    .Custom("ilhee_Custom", custom => custom
                        .Tokenizer(DefaultTokenizers.whitespace)
                        .Filter(DefaultTokenFilters.lowercase,DefaultTokenFilters.snowball,DefaultTokenFilters.stop)
                    )
                    .Custom("fulltext", custom => custom
                        .CharFilter(DefaultCharFilters.html_strip)
                        .Tokenizer(DefaultTokenizers.standard)
                        .Filter(DefaultTokenFilters.word_delimiter,
                                DefaultTokenFilters.lowercase,
                                DefaultTokenFilters.stop,
                                DefaultTokenFilters.standard)
                    )
                )                        
            )
            .BuildBeautified();
    }
lilly
  • 21
  • 7
  • What version of Elasticsearch are you targeting? It looks like you're using PlainElastic.Net and not NEST here. – Russ Cam Jun 08 '16 at 03:12
  • yes i use the plainelastic.net version 1.1.55 new version.... i would like to change the nest or plainelastic anyway – lilly Jun 08 '16 at 04:18
  • http://stackoverflow.com/questions/36454147/elasticsearch-upgrade-2-3-1-nest-client-raw-string?rq=1 the question is it ! ... nest is using the json file !.. – lilly Jun 09 '16 at 04:51

0 Answers0