# Dynamically Allocate Fields in the elasticsearch query

**URL:** https://discuss.elastic.co/t/dynamically-allocate-fields-in-the-elasticsearch-query/15916
**Category:** Elasticsearch
**Created:** [February 20, 2014, 7:14am UTC](https://discuss.elastic.co/t/dynamically-allocate-fields-in-the-elasticsearch-query/15916 "2014-02-20T07:14:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![soumya\_sengupta](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@soumya\_sengupta](https://discuss.elastic.co/u/soumya_sengupta)
#### Post date: [February 20, 2014, 7:14am UTC](https://discuss.elastic.co/t/dynamically-allocate-fields-in-the-elasticsearch-query/15916/1 "2014-02-20T07:14:42Z")

</div>

I have a query

query:  
{  
query\_string:  
{  
query: query,  
fields: ["First\_Name", "Last\_Name"],  
default\_operator: "AND"  
}  
}

I am using AngularJS.  
I want the value of the "fields:" to be provided at runtime ( through a  
checkbox selection by the user from an html page)

How should I go about it ?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a4cfd7e8-2489-494e-b5a4-f68ad3994dfd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a4cfd7e8-2489-494e-b5a4-f68ad3994dfd%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 1:48am UTC](https://discuss.elastic.co/t/dynamically-allocate-fields-in-the-elasticsearch-query/15916/2 "2017-07-06T01:48:53Z")

</div>


