Elasticsearch:具有 annotated_text 个字段的全文搜索

Elasticsearch: full-text search with annotated_text fields

如果我有注释文本:

Text1: "[Thomas Jefferson](_president_) was born in [Virginia](_place_)"
Text2: "[Thomas Jefferson](_writer_) was born in [Virginia](_place_)."  

我希望能够执行查询:

{
    "match_phrase": {
        "annotatedField": "_president_ was born in Virginia"
    }
}

并匹配 Text1,但不匹配 Text2。
我使用 Mapper Annotated Text Plugin 添加了注释文本。我没有使用这个插件,所以我愿意以任何方式在全文搜索中搜索自定义负载。谢谢!

事实证明,查询分析器正在从我的查询字符串中去除下划线。我可以通过将注释更改为

来使用注释进行搜索
Text1: "[Thomas Jefferson](ispresident) was born in [Virginia](isplace)"
Text2: "[Thomas Jefferson](iswriter) was born in [Virginia](isplace)."  

为了使用下划线,可以使用不同的查询分析器。