I have an ElasticSearch index that includes a "text" field that I would like to do ElasticSearch significant_terms aggregation on to determine meaningful terms and phrases from the "text" field. The problem I am facing, is the results are never a phrase, but instead always a one word term. The results may return something like: 'health' & 'care', but never 'health care'.
If anyone can please help me understand what I could be doing wrong.
Here is an example of my mapping:
{
"mappings" : {
"properties" : {
"keyword" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"text" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
},
"fielddata": true,
"index_phrases": true
}
}
}
}
Here is an example of query to get significant terms:
{
"query": {
"bool": {
"must": [
{
"match_phrase": {
"keyword" : "health care"
}
}
]
}
},
"size": 0,
"aggs": {
"test": {
"significant_terms": {
"field": "text"
}
}
}
}