如何在 属性 映射中给出分析器时分析句子 - elasticsearch

How to analyze a sentence when analyzer is given inside a property of mapping - elasticsearch

这是一个简单的问题:

通常当我在映射之外提供分析器时,我会查询这样的句子:

POST three_in_one_index4/_analyze
{
    "analyzer": "english_lower",
    "text": "<p>lorem ipsum dolor sit amet.</p>"    
}

现在我在映射内部给分析器如下:

"mappings": {
    "column": {
      "properties": {
        "article1": {
          "type": "text",
          "analyzer": "english_lower"
        },
        "article2": {
            "type": "text",
            "analyzer": "latin_lower"
        },
        "article3": {
            "type": "text",
            "analyzer": "latinstem_and_englishlower"
        }
      }
    }
  }

那么现在分析应该怎样呢?

我很确定下面的内容没有按照我的意思工作。

POST three_in_one_index4/_analyze
{
    "analyzer": "english_lower",
    "text": "<p>lorem ipsum dolor sit amet.</p>"    
} 

如果您想根据映射中定义的字段的分析器分析标记,那么您可以这样做:

curl -XGET 'localhost:9200/three_in_one_index4/_analyze' -d '
{
  "field" : "article1",
  "text" : "<p>lorem ipsum dolor sit amet.</p>"
}'

Will cause the analysis to happen based on the analyzer configured in the mapping for article1 (and if not, the default index analyzer).