0

尝试使用类似于雪球的英语词干分析器来确保多个搜索查询。

有标准的aws吗?还是我需要安装插件?我试过以下2,得到以下:

{"error":{"root_cause":[{"type":"remote_transport_exception","reason":"[dd63ee99c9186dd4b38e282ea58cbe6b][x.x.x.x:9300][indices:admin/create]"}],"type":"illegal_argument_exception","reason":"unknown setting [index.filter.my_stemmer.language] please check that any required plugins are installed, or check the breaking changes documentation for removed settings","suppressed":[{"type":"illegal_argument_exception","reason":"unknown setting [index.filter.my_stemmer.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"}]},"status":400}

尝试1:

PUT /my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_analyzer": {
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "my_stemmer"
          ]
        }
      },
      "filter": {
        "my_stemmer": {
          "type": "stemmer",
          "language": "light_german"
        }
      }
    }
  }
}

尝试2:

PUT /my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_analyzer": {
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "my_stemmer"
          ]
        }
      },
      "filter": {
        "my_stemmer": {
          "type": "snowball",
          "language": "English"
        }
      }
    }
  }
}
4

1 回答 1

0

让它与以下内容一起工作:

public void createSettingsWithEnglishStemAnalyzer() throws ExecutionException, InterruptedException, IOException {
    CreateIndexRequest request = new CreateIndexRequest(indexName);
    request.settings(Settings.builder()
            .put("index.max_inner_result_window", 250)
            .put("index.write.wait_for_active_shards", 1)
            .put("index.query.default_field", "paragraph")
            .put("index.number_of_shards", 3)
            .put("index.number_of_replicas", 2)
            .loadFromSource(Strings.toString(jsonBuilder()
                    .startObject()
                       .startObject("analysis")
                            .startObject("filter")
                                .startObject("english_stemmer")
                                .field("type","stemmer")
                                .field("name", "english")
                                .endObject()
                            .endObject()
                            .startObject("analyzer")
                                .startObject("EnglishStopWordAnalyzer")
                                    .field("tokenizer", "standard")
                                    .field("filter", new String[]{"lowercase","english_stemmer"})
                                .endObject()
                            .endObject()
                        .endObject()
                    .endObject()), XContentType.JSON)
    );
    CreateIndexResponse createIndexResponse = client.admin().indices().create(request).get();
    System.out.println("Index : "+createIndexResponse.index()+" Created");
    getSettingsWithAnalyzer();
}
于 2020-06-16T00:25:48.633 回答