# Scripting query

**URL:** <https://discuss.elastic.co/t/scripting-query/103473>\
**Category:** Elasticsearch\
**Created:** [October 11, 2017, 6:02am UTC](https://discuss.elastic.co/t/scripting-query/103473 "2017-10-11T06:02:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noel\_George](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/noel_george/32/23590_2.png) [@Noel\_George](https://discuss.elastic.co/u/Noel_George)\
**Post date:** [October 11, 2017, 6:02am UTC](https://discuss.elastic.co/t/scripting-query/103473/1 "2017-10-11T06:02:03Z")

</div>

Can someone please explain the purpose of each line

match": {  
"event\_data.SubjectUserName": "LOCAL SERVICE"  
}

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [October 13, 2017, 10:33am UTC](https://discuss.elastic.co/t/scripting-query/103473/2 "2017-10-13T10:33:47Z")

</div>

The first line instructs Elasticsearch to execute a "match" query. There are many different queries, and match is one of them. You can find information about the match query here: [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html)

The match query can be used to search for one or more terms in a specific field in your documents. In this case, Elasticsearch will search for the terms "LOCAL" or "SERVICE" in the field "event\_data.SubjectUserName" of your documents.

All documents that contain either (or both) of these terms will be a match. Elasticsearch will score the documents based on how well these documents match your query and by default returns you the top 10 documents with the highest score.

---

<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:** [November 10, 2017, 10:34am UTC](https://discuss.elastic.co/t/scripting-query/103473/3 "2017-11-10T10:34:01Z")

</div>

Closed on November 10, 2017, 10:34am UTC

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