Test data:
curl -XPUT 'localhost:9200/customer/external/1?pretty' -d '{ "body": "this is a test" }' curl -XPUT 'localhost:9200/customer/external/2?pretty' -d '{ "body": "and this is another test" }' curl -XPUT 'localhost:9200/customer/external/2?pretty' -d '{ "body": "this thing is a test" }'
My goal is to get the frequency of a phrase in a document.
I know how to get the frequency of terms in a document:
curl -g "http://localhost:9200/customer/external/1/_termvectors?pretty" -d' { "fields": ["body"], "term_statistics" : true }'
And I know how to count documents containing a given phrase (with match_phrase or span_near request):
curl -g "http://localhost:9200/customer/_count?pretty" -d' { "query": { "match_phrase": { "body" : "this is" } } }'
How can I access the frequency of a phrase?
elasticsearch elasticsearch-5
Gilles cuyaubere
source share