如何在使用河流插件时创建初始Elasticsearch设置

时间:2011-10-28 03:31:33

标签: search elasticsearch

我正在使用CouchDB的河流插件,当我执行以下curl命令时:

curl -XPUT 'localhost:9200/_river/blog/_meta' -d '{
  "type": "couchdb",
  "couchdb": {
    "host": "localhost",
    "port": 5984,
    "db": "blog",
    "filter": null
  },
  "index": {
    "analysis": {
      "analyzer": {
        "whitespace": {
          "type": "whitespace",
          "filter": "lowercase"
        },
        "ox_edgeNGram": {
          "type": "custom",
          "tokenizer": "ox_t_edgeNGram",
          "filter": [
            "lowercase"
          ]
        },
        "ox_NGram": {
          "type": "custom",
          "tokenizer": "ox_t_NGram",
          "filter": [
            "lowercase"
          ]
        }
      },
      "tokenizer": {
        "ox_t_edgeNGram": {
          "type": "edgeNGram",
          "min_gram": 2,
          "max_gram": 25,
          "side": "front"
        },
        "ox_t_NGram": {
          "type": "NGram",
          "min_gram": 2,
          "max_gram": 25
        }
      }
    }
  }
}'

收到回复:

{
  "ok": true,
  "_index": "_river",
  "_type": "blog",
  "_id": "_meta",
  "_version": 1
}

我遇到的问题是,当我想在浏览器中查看设置时,请转到: http://localhost:9200/blog/_settings?pretty=true

返回的json如下,但我期待有关我认为我创建的分析器等的信息。

返回JSON:

{
  "blog": {
    "settings": {
      "index.number_of_shards": "5",
      "index.number_of_replicas": "1"
    }
  }
}

还应该注意的是,当我在不使用河流的情况下创建博客索引并运行curl命令来输入分析信息时,我会收到浏览器的响应,指示我输入的设置。

如何在使用River插件时设置索引的默认设置?

2 个答案:

答案 0 :(得分:3)

要解决此问题:

  1. 创建新的Elasticsearch索引+映射等。
  2. 创建新的Elasticsearch河,其索引名称设置为在第一步中创建的索引的名称。
  3. 我在这里找到了答案:

    http://groups.google.com/a/elasticsearch.com/group/users/browse_thread/thread/5ebf1556d139d5ac/f17e71e04cac5889?lnk=gst&q=couchDB+river+settings#f17e71e04cac5889

答案 1 :(得分:1)

您可以尝试此网址http://localhost:9200/blog/_mapping?pretty=true 在响应映射中,如果未明确提及分析器,则它是默认分析器。