Is it possible to do a text query against a (pre)defined set of fields?
Hi, I am indexing some large documents in an index. When making full text queries, I've generally used {text: {_all: some text search}} to find all possible results. However, the document contains a few private fields that should be queryable only by a certain user group. What I was wondering is if there is a possibility to define some kind of alias for a set of fields (or even better - all fields except the set of fields) in the mapping definition. I could then do a query {text: {alias_for_public_fields: some text search}} while the private fields would not be searched for. I do not know if this is possible already now? I know that it's possible to list all fields in the query and leave out the privates, but as there can be hundreds of fields that should be queryable but only 2-3 private fields, listing fields explicitly adds significant overhead to the queries. Best regards, Ville -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8dc6c390-b483-40d0-bc4e-264380743aef%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Is it possible to do a text query against a (pre)defined set of fields?
Ville, Perhaps: Don't include the private fields in _all. Then a query against _all would be restricted to the (perhaps hundreds) of public fields. A query that includes the private fields would need to list _all and then the private fields. But since you have only 2 or 3 private fields, there shouldn't be much overhead on the query. Brian -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0692b19c-2c81-441b-ba2c-c7d33f98648c%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Is it possible to do a text query against a (pre)defined set of fields?
Hi, Well - I think I've understood something wrong here. Isn't _all a special key that includes all indexed fields? Is there possibility to change the fields included in _all? Ville Ville, Perhaps: Don't include the private fields in _all. Then a query against _all would be restricted to the (perhaps hundreds) of public fields. A query that includes the private fields would need to list _all and then the private fields. But since you have only 2 or 3 private fields, there shouldn't be much overhead on the query. Brian -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d326a968-9ed9-44e9-8640-9b00d9507c05%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Is it possible to do a text query against a (pre)defined set of fields?
Ville, By default, the _all field includes all of the indexed field. Then, for your private fields, explicitly exclude them from the _all field by adding the following to their properties: include_in_all : false See the ES guide for more details, Specifically, thishttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-all-field.htmlmight help. I typically disable the _all field completely to cut down dramatically on disk space and build times. But everything else in ES has worked like a charm, so I'm sure this would work for you without too much trouble. Good luck! Brian -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/54d7375c-2644-4b81-8e0e-51e74140f0aa%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.