Hi to everybody,
I have an index containing topics of a forum.
I match the phrase (specified by users) with multi_match in fields title, body and tags.
Users can also "search any words" or "search the phrase"; if use "search any words" all works fine.
If user choose "search the phrase" I use a multi_match type "phrase" but the search failed.
Into elasticsearch logs I found:
field "tags" was indexed without position data; cannot run PhraseQuery
When I had created index I had used this mapping:
"mappings" : {
"topics" : {
"date_detection" : false,
"dynamic_templates" : [
{
"generic_not_analyzed" : {
"match" : ".+",
"unmatch" : "(title)|(body)|(clean_body)",
"match_pattern" : "regex",
"mapping" : {
"index": "not_analyzed"
}
}
}
],
"properties" : {
"created": {"type": "date", "format": "dateTimeNoMillis"},
"lastupdate": {"type": "date", "format": "dateTimeNoMillis"},
"ts_author_oldest_post": {"type": "date", "format": "dateTimeNoMillis"},
"ts_sort_dashboard": {"type": "date", "format": "dateTimeNoMillis"},
"tags" : {"type" : "string", "index" : "not_analyzed"},
"gallery": {
"properties": {
"approved": {"type": "date", "format": "dateTimeNoMillis"},
"thumbs_update": {"type": "date", "format": "dateTimeNoMillis"}
}
},
"template": {
"properties": {
"approved": {"type": "date", "format": "dateTimeNoMillis"}
}
},
"posts" : {
"type": "nested",
"include_in_parent": true,
"properties": {
"submitted" : {"type": "date", "format": "dateTimeNoMillis"},
"body" : {"type": "string", "analyzer": "answ_html_default"}
}
},
"followers" : {
"type": "nested",
"include_in_parent": true,
"properties": {
"id": {"type": "integer"},
"level": {"type": "string"},
"name": {"type": "string"},
"read": {"type": "boolean"},
"date_read": {"type": "date", "format": "dateTimeNoMillis"},
"date_follow": {"type": "date", "format": "dateTimeNoMillis"}
}
}
}
}
}
Someone can help me?