Re: Issue with phrase_prefix query for the _id field


(Ajinkya Apte) #1

Hello,
I am having some trouble with getting the phrase_prefix search working with
the _id field. Here is my example:

#Reset the index
DELETE /profile-101

#Mapping creation
PUT /profile-101
{
"mappings": {
"profile": {
"properties": {
"full-name" : {
"type": "string"
}
}
}
}
}

#Document creation
POST /profile-101/profile/nickname/
{
"full-name" : "Ajinkya Apte"
}

Issue:

  1. When I do:
    GET /profile-101/profile/_search
    {
    "query" : {
    "match" : {
    "full-name" : {
    "query" : "Ajin",
    "type" : "phrase_prefix"
    }
    }
    }
    }
    I get the result correctly;

However when I do something similar for the _id field it does not work

GET /profile-101/profile/_search
{
"query" : {
"match" : {
"_id" : {
"query" : "nic",
"type" : "phrase_prefix"
}
}
}
}

I am probably missing something here, can someone please point me in the
right direction?
I eventually want to combine the two queries using multi_match but first
want to figure out the correct way to run a phrase_prefix query on the _id
field:
GET /profile-101/profile/_search
{
"query" : {
"multi_match" : {
"query": "User query",
"type": "phrase_prefix",
"fields": [ "_id", "full-name" ],
"tie_breaker": 0.3
}
}
}

Thanks,
AJ

--
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/fafb6209-626a-4dfd-a1a7-121e8e8e38b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Ajinkya Apte) #2

Can anyone help me please?

AJ

On Thursday, August 28, 2014 2:05:18 AM UTC-7, Ajinkya Apte wrote:

Hello,
I am having some trouble with getting the phrase_prefix search working
with the _id field. Here is my example:

#Reset the index
DELETE /profile-101

#Mapping creation
PUT /profile-101
{
"mappings": {
"profile": {
"properties": {
"full-name" : {
"type": "string"
}
}
}
}
}

#Document creation
POST /profile-101/profile/nickname/
{
"full-name" : "Ajinkya Apte"
}

Issue:

  1. When I do:
    GET /profile-101/profile/_search
    {
    "query" : {
    "match" : {
    "full-name" : {
    "query" : "Ajin",
    "type" : "phrase_prefix"
    }
    }
    }
    }
    I get the result correctly;

However when I do something similar for the _id field it does not work

GET /profile-101/profile/_search
{
"query" : {
"match" : {
"_id" : {
"query" : "nic",
"type" : "phrase_prefix"
}
}
}
}

I am probably missing something here, can someone please point me in the
right direction?
I eventually want to combine the two queries using multi_match but first
want to figure out the correct way to run a phrase_prefix query on the _id
field:
GET /profile-101/profile/_search
{
"query" : {
"multi_match" : {
"query": "User query",
"type": "phrase_prefix",
"fields": [ "_id", "full-name" ],
"tie_breaker": 0.3
}
}
}

Thanks,
AJ

--
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/2f1b9e8b-1c75-4ad3-a6dd-a3fd528eea09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3