Embedded field search


(gitfy) #1

Hi,
I have something like this :

{
customer : {
key : 12121,
displayName: 'Customer 1'

.....

}

When i search

http://localhost:9200/test/_search?q=customer.displayName:customer

i get results. But when i do

http://localhost:9200/test/_search?q=customer:customer

without the embedded field name, i don't get it. Is there way to
accomplish this using tokenizers or analyzers...i coudn't firgure out
from the documentation how to write a custom tokenizer script, rather
the documentation provides only how to define a new one.

One way to achieve this, to transform the document before posting to
the search engine, but that changes the doc structure of the results
and i want to keep the structure same throughout the application.

Any help.


(Shay Banon) #2

You can't find it on customer because its does not end up as a field being indexed. In theory, elasticsearch could build a complex query to boolean search on all the customer sub fields. Its a possible feature....

Its not related to tokenizers, unless you want to create something similar to the _all field, just on the customer level.
On Monday, April 11, 2011 at 9:28 PM, gitfy wrote:
Hi,

I have something like this :

{
customer : {
key : 12121,
displayName: 'Customer 1'

.....

}

When i search

http://localhost:9200/test/_search?q=customer.displayName:customer

i get results. But when i do

http://localhost:9200/test/_search?q=customer:customer

without the embedded field name, i don't get it. Is there way to
accomplish this using tokenizers or analyzers...i coudn't firgure out
from the documentation how to write a custom tokenizer script, rather
the documentation provides only how to define a new one.

One way to achieve this, to transform the document before posting to
the search engine, but that changes the doc structure of the results
and i want to keep the structure same throughout the application.

Any help.


(system) #3