Stree Address Queries

I have a field that contains the full address, e.g. 1200 S FUN ST.
I need to accomplish two type of searches one a suggest search with
synonyms so that users can type ahead "1200 Fun ave" which can be "1200 Fun
Avenue" or "1200 E Fun Ave". How have other accomplished this type of
search and what type of tokenizing needs to be used?

One my second type is more of a full text exact search but my search
results don't match correctly. I 1st setup the field fullAddress as a
"string" map:

  • fullAddress:
    {
    • type: "string"
      },

When I query for say Fun St I get results that include S Fun St and N Fun
St and plain Fun St.

"text": {
"fullAddress": "Fun St"
}

However, when I then try to search for "S Fun St" it result also results
with "Fun St" and other addresses with "S" in it.

"text": {
"fullAddress": "S Fun St"
}

From reading some other posts they suggest using a mapping where the field
is not analyzed. So I changed the field to the following:

  • fullAddress:
    {
    • type: "string",
    • index: "not_analyzed",
    • omit_norms: true,
    • index_options: "docs"
      },

But now when I do the query I don't get any results unless the I do an
exact query that does a complete match. Any thoughts?

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/67310fc1-082b-41de-9b92-4bb70f539397%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

You probably want to "upgrade" to the match query - "text" queries are
older and no longer exist in 1.x. But anyway when you query:

"match": { "f": "S Fun St" }

You are effectively doing (roughly):

f=S or f=fun or f=St

You could make it do AND if you want (in which case a match is only found
if the document/field value contains all terms):

{
"match" : {
"f" : {
"query" : "S Fun St",
"operator" : "and"
}
}
}

You could also do OR with a minimum_should_match parameter to specify how
many of the individual terms should match the document/field value:

{
"match" : {
"f" : {
"query" : "S Fun St",
"minimum_should_match" : 2
}
}
}

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/611427d1-cf08-4fec-a79d-b725a989ca86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks for the great explanation. Is there also a comparable equivalent
when using query string?

On Wednesday, March 26, 2014 2:25:05 PM UTC-6, Binh Ly wrote:

You probably want to "upgrade" to the match query - "text" queries are
older and no longer exist in 1.x. But anyway when you query:

"match": { "f": "S Fun St" }

You are effectively doing (roughly):

f=S or f=fun or f=St

You could make it do AND if you want (in which case a match is only found
if the document/field value contains all terms):

{
"match" : {
"f" : {
"query" : "S Fun St",
"operator" : "and"
}
}
}

You could also do OR with a minimum_should_match parameter to specify how
many of the individual terms should match the document/field value:

{
"match" : {
"f" : {
"query" : "S Fun St",
"minimum_should_match" : 2
}
}
}

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/cd425185-e2e0-4d8f-ba1c-c357b54cd4d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.