How can I use multi_match and partial keyword


(Nikolay Chankov) #1

I refined my query to the following:

curl -XGET
'http://localhost:9200/venues,events,offers,users/_search?pretty=true' -d '
{
"query" : {

                "indices" : {
                    "indices" : ["venues", "events", "users", "offers"],
                    "query" : {
                        "multi_match" : {
                            "query" : "Evo*",
                            "fields" : ["name^4", "first_name^4", 

"last_name^4", "town^3.5", "_all^0.5"]
}
}
}

}

}'

The problem now is that the * in the query doesn't take effect. i.e. If I
use "Evo*" a node which has name="Evoke" doesn't show in the results,
while if I search for "Evoke" it show the desired result.

So the question is: How to search for partial term within the field.

Thank you in advance.

--
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/a73bba3e-d91b-4da9-a373-033d6f220f1e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

Try with evo* (lowercase).

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 27 décembre 2013 at 15:10:50, Nikolay Chankov (nchankov@gmail.com) a écrit:

I refined my query to the following:

curl -XGET 'http://localhost:9200/venues,events,offers,users/_search?pretty=true' -d '
{
"query" : {

                "indices" : {
                    "indices" : ["venues", "events", "users", "offers"],
                    "query" : {
                        "multi_match" : {
                            "query" : "Evo*",
                            "fields" : ["name^4", "first_name^4", "last_name^4", "town^3.5", "_all^0.5"]
                        }
                    }
                }
            
}

}'

The problem now is that the * in the query doesn't take effect. i.e. If I use "Evo*" a node which has name="Evoke" doesn't show in the results, while if I search for "Evoke" it show the desired result.

So the question is: How to search for partial term within the field.

Thank you in advance.

--
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/a73bba3e-d91b-4da9-a373-033d6f220f1e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/etPan.52bda6a6.836c40e.55aa%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.


(Nikolay Chankov) #3

Thank you for the reply David, but unfortunately it doesn't make any
difference. :frowning:

On Friday, December 27, 2013 4:11:18 PM UTC, David Pilato wrote:

Try with evo* (lowercase).

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr

Le 27 décembre 2013 at 15:10:50, Nikolay Chankov (ncha...@gmail.com<javascript:>)
a écrit:

I refined my query to the following:

curl -XGET '
http://localhost:9200/venues,events,offers,users/_search?pretty=true' -d '
{
"query" : {

                "indices" : {
                    "indices" : ["venues", "events", "users", 

"offers"],
"query" : {
"multi_match" : {
"query" : "Evo*",
"fields" : ["name^4", "first_name^4",
"last_name^4", "town^3.5", "_all^0.5"]
}
}
}

}

}'

The problem now is that the * in the query doesn't take effect. i.e. If I
use "Evo*" a node which has name="Evoke" doesn't show in the results,
while if I search for "Evoke" it show the desired result.

So the question is: How to search for partial term within the field.

Thank you in advance.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/a73bba3e-d91b-4da9-a373-033d6f220f1e%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/b8c7c099-e7b5-412d-89f5-9bf2680bbf50%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #4

Could you gist a full curl recreation?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 27 déc. 2013 à 17:37, Nikolay Chankov nchankov@gmail.com a écrit :

Thank you for the reply David, but unfortunately it doesn't make any difference. :frowning:

On Friday, December 27, 2013 4:11:18 PM UTC, David Pilato wrote:

Try with evo* (lowercase).

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 27 décembre 2013 at 15:10:50, Nikolay Chankov (ncha...@gmail.com) a écrit:

I refined my query to the following:

curl -XGET 'http://localhost:9200/venues,events,offers,users/_search?pretty=true' -d '
{
"query" : {

                "indices" : {
                    "indices" : ["venues", "events", "users", "offers"],
                    "query" : {
                        "multi_match" : {
                            "query" : "Evo*",
                            "fields" : ["name^4", "first_name^4", "last_name^4", "town^3.5", "_all^0.5"]
                        }
                    }
                }
            
}

}'

The problem now is that the * in the query doesn't take effect. i.e. If I use "Evo*" a node which has name="Evoke" doesn't show in the results, while if I search for "Evoke" it show the desired result.

So the question is: How to search for partial term within the field.

Thank you in advance.

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a73bba3e-d91b-4da9-a373-033d6f220f1e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/b8c7c099-e7b5-412d-89f5-9bf2680bbf50%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/F252B773-49AD-47A8-95FC-31B0C8CA3871%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.


(Nikolay Chankov) #5

The indexes are populated from jdbc river, so I will try to create an
example. The behavior is the same. HTH

Here it is:
curl -XDELETE 'http://localhost:9200/test_venues'
curl -XPUT 'http://localhost:9200/test_venues'
curl -XPUT 'http://localhost:9200/test_venues/test_venue/_mapping' -d '
{
"test_venue" : {
"properties" : {
"object" : { "type" : "string" },
"id" : { "type" : "integer" },
"name" : { "type" : "string" }
}
}
}'
curl -XPUT 'http://localhost:9200/test_venues/test_venue/1' -d '{
"object" : "Venue",
"id" : 1,
"name" : "Evoke"
}'
curl -XPUT 'http://localhost:9200/test_venues/test_venue/2' -d '{
"object" : "Venue",
"id" : 1,
"name" : "Evo"
}'

curl -XGET 'http://localhost:9200/test_venues/_search?pretty=true' -d '
{
"query" : {
"indices" : {
"indices" : ["test_venues"],
"query" : {
"multi_match" : {
"query" : "evo*",
"fields" : ["name^4", "_all^1"]
}
}
}
}
}'

On Friday, December 27, 2013 5:21:13 PM UTC, David Pilato wrote:

Could you gist a full curl recreation?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 27 déc. 2013 à 17:37, Nikolay Chankov <ncha...@gmail.com <javascript:>>
a écrit :

Thank you for the reply David, but unfortunately it doesn't make any
difference. :frowning:

On Friday, December 27, 2013 4:11:18 PM UTC, David Pilato wrote:

Try with evo* (lowercase).

--
David Pilato | Technical Advocate | Elasticsearch.com
http://Elasticsearch.com

@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr

Le 27 décembre 2013 at 15:10:50, Nikolay Chankov (ncha...@gmail.com) a
écrit:

I refined my query to the following:

curl -XGET '
http://localhost:9200/venues,events,offers,users/_search?pretty=true' -d
'
{
"query" : {

                "indices" : {
                    "indices" : ["venues", "events", "users", 

"offers"],
"query" : {
"multi_match" : {
"query" : "Evo*",
"fields" : ["name^4", "first_name^4",
"last_name^4", "town^3.5", "_all^0.5"]
}
}
}

}

}'

The problem now is that the * in the query doesn't take effect. i.e. If I
use "Evo*" a node which has name="Evoke" doesn't show in the results,
while if I search for "Evoke" it show the desired result.

So the question is: How to search for partial term within the field.

Thank you in advance.

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/a73bba3e-d91b-4da9-a373-033d6f220f1e%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/b8c7c099-e7b5-412d-89f5-9bf2680bbf50%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/cd8c5f63-9b28-4f58-9eba-579c3ef27173%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #6

match query and multi match query does not support wildcards.
That said, it's often a bad practice in elasticsearch using wildcards queries because they are slow.

You should may be change your mapping and use ngrams or edge ngrams for your field.

And just query this field with "evo" without any wildcard.

HTH

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 27 décembre 2013 at 18:59:55, Nikolay Chankov (nchankov@gmail.com) a écrit:

curl -XDELETE 'http://localhost:9200/test_venues'
curl -XPUT 'http://localhost:9200/test_venues'
curl -XPUT 'http://localhost:9200/test_venues/test_venue/_mapping' -d '
{
"test_venue" : {
"properties" : {
"object" : { "type" : "string" },
"id" : { "type" : "integer" },
"name" : { "type" : "string" }
}
}
}'
curl -XPUT 'http://localhost:9200/test_venues/test_venue/1' -d '{
"object" : "Venue",
"id" : 1,
"name" : "Evoke"
}'
curl -XPUT 'http://localhost:9200/test_venues/test_venue/2' -d '{
"object" : "Venue",
"id" : 1,
"name" : "Evo"
}'

curl -XGET 'http://localhost:9200/test_venues/_search?pretty=true' -d '
{
"query" : {
"indices" : {
"indices" : ["test_venues"],
"query" : {
"multi_match" : {
"query" : "evo*",
"fields" : ["name^4", "_all^1"]
}
}
}
}
}'

--
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/etPan.52be985d.419ac241.55aa%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #7