# Annotate Text with Numbers and Search by Range ... use annotated\_text?

**URL:** <https://discuss.elastic.co/t/annotate-text-with-numbers-and-search-by-range-use-annotated-text/229478>\
**Category:** Elasticsearch\
**Created:** [April 23, 2020, 1:51pm UTC](https://discuss.elastic.co/t/annotate-text-with-numbers-and-search-by-range-use-annotated-text/229478 "2020-04-23T13:51:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Sander](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_sander/32/838_2.png) [@Michael\_Sander](https://discuss.elastic.co/u/Michael_Sander)\
**Post date:** [April 23, 2020, 1:51pm UTC](https://discuss.elastic.co/t/annotate-text-with-numbers-and-search-by-range-use-annotated-text/229478/1 "2020-04-23T13:51:59Z")

</div>

Is it possible to combine a text search with a number range search, where you want to find the numbers **near** the text?

I have a corpus of unstructured data that includes both numbers and text, the following would be a typical (but abbreviated) sample document:

> John Smith's specialty is biology, and noted his hourly rates is **$150** /hour. ... Sarah Marsh's has 6 months of experience in electronics, and has a rate of **$50** /hour. ... Jane Johnson has worked for many years in the field of electronics, and charges **$120** /hour.

I want to run searches such as: find documents with the word "electronics" where that word _appears near_ a dollar amount rate between $100-200.

My current solution has a mapping with two fields:

- A `text` field to search the text
- A `double` field for hourly rates (I extract these dollar amounts from the text at index time)

Unfortunately, while this mapping allows me to run searches on the text and a range of dollar amounts, it does not store the proximity information, so it **cannot search for text near a dollar amount range**.

I see the `annotated_text` plugin allows you to annotate text and keep proximity information, but that does not appear to work with numbers.

What would be a good data model to enable these types of range + text + proximity searches?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 21, 2020, 1:52pm UTC](https://discuss.elastic.co/t/annotate-text-with-numbers-and-search-by-range-use-annotated-text/229478/2 "2020-05-21T13:52:05Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
