# Is there a way to use a Query to filter/test against one doc in memory?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-use-a-query-to-filter-test-against-one-doc-in-memory/42267>\
**Category:** Elasticsearch\
**Created:** [February 19, 2016, 5:19pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-use-a-query-to-filter-test-against-one-doc-in-memory/42267 "2016-02-19T17:19:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_J\_Luo](https://avatars.discourse-cdn.com/v4/letter/j/dbc845/32.png) [@Josh\_J\_Luo](https://discuss.elastic.co/u/Josh_J_Luo)\
**Post date:** [February 19, 2016, 5:19pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-use-a-query-to-filter-test-against-one-doc-in-memory/42267/1 "2016-02-19T17:19:29Z")

</div>

Similar to Lucene's MemoryIndex, for example:

Query query = parseQuery("{'match' : { 'name', 'Trump'}}");  
String doc = "{'\_source': { 'name': 'Trump'}}";  
float score = query.getScore(doc);

if score \> 0 it means matched successfully

---

<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:** [July 5, 2017, 11:14pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-use-a-query-to-filter-test-against-one-doc-in-memory/42267/2 "2017-07-05T23:14:47Z")

</div>

Closed on July 5, 2017, 11:14pm UTC


