agonzalez
(Alberto)
November 29, 2016, 2:51pm
1
I am doing a search by a guid but it returns more documents not matching the full guid.
If i search for: 333-600-123-334 it returns any doc containing 600 per example. How can i match the full guid string?
var result = elk.Search<xxxDto>(x => x
.From(0)
.Index("index-*")
.Size(300)
.AllTypes()
.Query(q =>
q.Match(qs => qs.Field("asset_tag").Query("333-600-123-334)))
.Sort(ss => ss.Descending(p => p.sort_start_time))
);
agonzalez
(Alberto)
December 20, 2016, 12:17am
2
Any tip for this? on how to escape "-"?
agonzalez
(Alberto)
December 20, 2016, 12:19am
3
I am trying to use this: but generates invalid response.
query_string = "SNMPv2 - SMI::enterprises.21865.1.1.6: "333-600-123-334"";
q.QueryString(qs => qs.Query(query_string)))
This worksbut returns any doc containing 333 or 666 or 123, etc:
q.Match(qs => qs.Field("SNMPv2-SMI::enterprises.21865.1.1.6").Query("333-600-123-334")))
KodrAus
(Ashley Mannix)
December 27, 2016, 5:15am
4
I believe the problem here is that your guids are tokenised by the -
, and the query is also being tokenised, so it's finding partial matches for you.
What you want is to match the exact query text, which you can do using a constant_score
query. See this article for details.
If you're only ever going to query exact guid matches, then you could also disable tokenisation for that field to save some index space.
system
(system)
Closed
January 24, 2017, 5:16am
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.