How to apply search in more than one field using java?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to apply search in more than one field using java?

Sam-4
Hi

I have Two index: accounts and customerException

indexschema are as follows:

Accounts index:
--------------------------
AccountID   AccountName
  1                 abc
  2                 cdf


customerException index:
Here the primary key is the combination of AccountID and customerID
------------------------------------
AccountID   priorityvalue1 priorityvalue2 customerID

1                   p1                     p2             c101
2                   p3                     p4             c102


Requirement:

I want to search priorityvalue1 and priorityvalu2 for given
AccountName and customerID.for that i have required  to get accountID
from Accounts index for corresponding accountName,then using this
accountID and customerID i have to retrieve  priority value1 and
prorityvalue2 from customerException index.

Qusetion :

As i have explored Elastic i found to search the data in a single
field. but here i have to check the condition in two fields. Here I am
not getting that how i will apply the query to get the desired result.


Thanks
Reply | Threaded
Open this post in threaded view
|

Re: How to apply search in more than one field using java?

Karussell
ElasticSearch is not a normal database. You'll need to store the data
denormalized e.g. in one doc:

AccountID AccountName priorityvalue1 priorityvalue2 customerID

Peter.

On Feb 15, 9:19 am, sam <[hidden email]> wrote:

> Hi
>
> I have Two index: accounts and customerException
>
> indexschema are as follows:
>
> Accounts index:
> --------------------------
> AccountID   AccountName
>   1                 abc
>   2                 cdf
>
> customerException index:
> Here the primary key is the combination of AccountID and customerID
> ------------------------------------
> AccountID   priorityvalue1 priorityvalue2 customerID
>
> 1                   p1                     p2             c101
> 2                   p3                     p4             c102
>
> Requirement:
>
> I want to search priorityvalue1 and priorityvalu2 for given
> AccountName and customerID.for that i have required  to get accountID
> from Accounts index for corresponding accountName,then using this
> accountID and customerID i have to retrieve  priority value1 and
> prorityvalue2 from customerException index.
>
> Qusetion :
>
> As i have explored Elastic i found to search the data in a single
> field. but here i have to check the condition in two fields. Here I am
> not getting that how i will apply the query to get the desired result.
>
> Thanks