【发布时间】:2017-04-01 07:49:22
【问题描述】:
我使用的是普通荧光笔(Elasticsearch 5.2)。这是一个例子
PUT bookstore
{
"mappings": {
"books": {
"properties": {
"list": {
"properties": {
"summary": {
"type": "text"
},
"title": {
"type": "text"
}
}
}
}
}
}
}
POST bookstore/books/1
{
"list": [
{
"summary": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
"title": "Elasticsearch"
}
]
}
GET bookstore/books/_search
{
"query": {
"simple_query_string": {
"query": "scrambled"
}
},
"highlight": {
"fields": {
"*": {
"require_field_match": false,
"number_of_fragments": 1,
"fragment_size": 70
}
}
}
}
"highlight": {
"list.summary": [
" <em>scrambled</em> it to make a type specimen book. It has survived not only five"
]
}
我的问题是,如何使突出显示的单词居中?在这种情况下,突出显示的单词在开头,在其他情况下在结尾。我怎样才能确保它在中间?
理想情况下,我想要的是在突出显示的文本之前和之后指定标记的数量,而不是片段大小。
【问题讨论】:
标签: elasticsearch