Using Terms Query


(Francisco) #1

Hello guys,

I'm looking for some help on the topic Terms Query(URL Available)
"https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html".

What I'm trying to do it's something like it's been done on the example above. I'm not being able to understand it clear so where it goes what I'm trying to do.

I wanna be able to present data that I've got in two index like in the example. Can someone explain it to me in a more clear way? What I'm trying to achive, it's a query that giving a certain code, gets a string from another index. If you got questions, or if it's confusing please let me know.

Thanks in advance

Cheers!


(David Pilato) #2

It sounds like a join.
Join is not supported in elasticsearch unless you use parent/child feature.


(Francisco) #3

It's kinda of one. But can't this Term Query do the trick? I'm not being able to full understand it.


(David Pilato) #4

Hmm. I see.

What you don't understand in the given example in the page?


(Francisco) #5

I think I got it meanwhile. Now I've got another question.

This returns the index if all conditions are true, but what I wanna do is the following:

  1. Get this condition true (I have to found someway of getting the id)
  2. After this, "attribute" a field from the second index to the first
  3. Return it (with GET if I'm being clear).

Thanks!


(Anish Ansari) #6

i have one index like userdata , in userdata index emailid and password there , please tell me term query or another query to find exact match . now i m using term query to check emailid and passwrd from my all inder record but didnt return the result .. please help me..

now i m using this syntax . but not working
query : { "bool" :
{
"must" :
[
{ "bool" :
{"must":[
{ "match" : {email_id : {query : email} } },
{ "match" : {password : {query : password} } }
]
}
}
]
}
}

Note - i want to exact match emailid and password value from userdata index records and return only one record if exact match otherwise no result .


(David Pilato) #7

@Anish_Ansari please open your own question. This seems unrelated.
Also please provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.


(Anish Ansari) #9

i have login form with input email and password . i want to check these input values from my elastic search index records with exact match.

now i m using this . but this not match exact .

client.search(
{
index:index_name,
type: type_name,
body:
{
query : { "bool" :
{
"must" :
[
{ "bool" :
{
"must":
[
{ "match" : {email_id : {query : email} } },
{ "match" : {password : {query : password} } }
]
}
}
]
}
}
},
}).then(function (resp)
{
console.log("********"+resp.hits.hits.length);
}, function (err)
{
console.trace(err.message);
})

Please help . and give me correct query for exact match


(David Pilato) #10

Please open your own question. This seems unrelated.

I'm not going to answer here.
And please follow the instructions I gave previously (full reproduction script, well formatted) if you want to get faster answers.


(Anish Ansari) #11

client.search(
{
index:index_name,
type: type_name,
body:
{
query : { "bool" :
{
"must" :
[
{ "bool" :
{
"must":
[
{ "match" : {email_id : {query : email} } },
{ "match" : {password : {query : password} } }
]
}
}
]
}
}
},
}).then(function (resp)
{
console.log("********"+resp.hits.hits.length);
}, function (err)
{
console.trace(err.message);
})

this is my query for exact match of my inputs from index records, but not get correct result please help me


(system) #12

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