Как бы я создать индекс для этого с помощью C # - PullRequest
0 голосов
/ 03 мая 2019

Я новичок в nest и у меня есть скрипт создания индекса, который я могу запустить в curl.Я хочу создать это в C #, используя следующий.Я был бы очень признателен за любую помощь.Я посмотрел на доски, но я все еще в замешательстве.

Это мой индекс:

curl -XPUT http://localhost:9200/knowledgebaseproduct1 -H'Content- 
Type: application/json' -d '{
    "settings": {
        "number_of_shards": 1,
        "number_of_replicas": 0,
        "max_result_window" : "3000",
        "analysis": {
            "char_filter": {
                "removewhitespaces": {
                    "type": "pattern_replace",
                    "pattern": "\\s+",
                    "replacement": ""
                }
            },
            "filter": {
                "autocomplete_filter": {
                    "type": "edge_ngram",
                    "min_gram": 3,
                    "max_gram": 30
                },
                "removesymbols": {
                    "type": "pattern_replace",
                    "pattern": "[^A-Za-z0-9]",
                    "replacement": ""
                }
            },
            "analyzer": {
                "autocomplete": {
                    "type": "custom",
                    "tokenizer": "standard",
                    "filter": [
                        "lowercase",
                        "autocomplete_filter"
                    ]
                },
                "keyvalue": {
                    "type": "custom",
                    "tokenizer": "keyword",
                    "filter": [
                        "lowercase",
                        "asciifolding",
                        "removesymbols"
                    ],
                    "char_filter": [
                        "removewhitespaces"
                    ]
                },
                "basic": {
                    "type": "custom",
                    "tokenizer": "standard",
                    "filter": [
                        "lowercase"
                    ]
                }
            }
        }
    },
    "mappings": {
        "doc": {
            "dynamic": "strict",
            "properties": {
                "CompliFolderCompliFolderIdCriteria":{
                    "type": "long"
                },
                "CompliFolderCompanyIdCriteria": {
                    "type": "long"
                },
                "CompliFolderPhysicalStateLkpIdCriteria": {
                    "type": "long"
                },
                "CompliFolderStatusLkpIdCriteria":{
                    "type": "long"
                },
                "ObtainmentActionsNoticeNumberCriteria":{
                    "type": "text",
                    "fields": {
                        "autocompletefield": {
                            "type": "text",
                            "analyzer": "autocomplete",
                            "search_analyzer": "standard"
                        },
                        "keyvaluefield": {
                            "type": "text",
                            "analyzer": "keyvalue"
                        },
                        "basicfield": {
                            "type": "text",
                            "analyzer": "basic"
                        }
                    }
                },
                "ObtainmentWorkItemContainsProductCriteria":{
                    "type": "long"
                },
                "CompliFolderFolderNameCriteria": {
                    "type": "text",
                    "fields": {
                        "autocompletefield": {
                            "type": "text",
                            "analyzer": "autocomplete",
                            "search_analyzer": "standard"
                        },
                        "keyvaluefield": {
                            "type": "text",
                            "analyzer": "keyvalue"
                        },
                        "basicfield": {
                            "type": "text",
                            "analyzer": "basic"
                        }
                    }
                },
                "NameNumberNameOrNumberCriteria": {
                    "type": "text",
                    "fields": {
                        "autocompletefield": {
                            "type": "text",
                            "analyzer": "autocomplete",
                            "search_analyzer": "standard"
                        },
                        "keyvaluefield": {
                            "type": "text",
                            "analyzer": "keyvalue"
                        },
                        "basicfield": {
                            "type": "text",
                            "analyzer": "basic"
                        }
                    }
                },
                "NameNumberAliasCriteria": {
                    "type": "text",
                    "fields": {
                        "autocompletefield": {
                            "type": "text",
                            "analyzer": "autocomplete",
                            "search_analyzer": "standard"
                        },
                        "keyvaluefield": {
                            "type": "text",
                            "analyzer": "keyvalue"
                        },
                        "basicfield": {
                            "type": "text",
                            "analyzer": "basic"
                        }
                    }
                },
                "CompanyNameCriteria": {
                    "type": "text",
                    "fields": {
                        "autocompletefield": {
                            "type": "text",
                            "analyzer": "autocomplete",
                            "search_analyzer": "standard"
                        },
                        "keyvaluefield": {
                            "type": "text",
                            "analyzer": "keyvalue"
                        },
                        "basicfield": {
                            "type": "text",
                            "analyzer": "basic"
                        }
                    }
                },
                "CompanyAliasNameCriteria": {
                    "type": "text",
                    "fields": {
                        "autocompletefield": {
                            "type": "text",
                            "analyzer": "autocomplete",
                            "search_analyzer": "standard"
                        },
                        "keyvaluefield": {
                            "type": "text",
                            "analyzer": "keyvalue"
                        },
                        "basicfield": {
                            "type": "text",
                            "analyzer": "basic"
                        }
                    }
                }
            }
        }
    }
}'
sleep 5
...