Query string on an attachment field

Hi,

Is it possible to perform a query string on a specific attachment field :

{

"query_string" : {

    "fields" : ["files", "content"],

    "query" : "my text"

}

}

This query should search in the content AND the attachments.

But nothing is returned. If I keep the default field, it's ok.

Am I missing something in the mapping ("files":{"type":"attachment"}) ?

thx

--
cheers,
ahb

Based on the previous gist ( https://gist.github.com/1075067 https://gist.github.com/1075067 ), I tried to search on file field (aka the attachment field).

I searched for :

curl "${host}/_search?pretty=true" -d '{

"fields" : ["file"],

"query" : {

"query_string" : {

  "query" : "amplifier"

}

},

"highlight" : {

"fields" : {

  "file" : {}

}

}

}'

And get the result.

{

"took" : 81,

"timed_out" : false,

"_shards" : {

"total" : 1,

"successful" : 1,

"failed" : 0

},

"hits" : {

"total" : 1,

"max_score" : 0.005872132,

"hits" : [ {

  "_index" : "test",

  "_type" : "attachment",

  "_id" : "s_C9wgsCQRKteC4i_WbjjQ",

  "_score" : 0.005872132,

  "fields" : {

    "file" : "[I REMOVED THE PDF CONTENT] "

  },

  "highlight" : {

    "file" : [ "\nMono <em>Amplifier</em>\nThe ISL99201 is a fully integrate                                        d high efficiency class-D \nmono <em>amplifier</em>. It is designed" ]

  }

} ]

}

}

I really think that your mapping is incorrect. Don’t you see something strange in logs when you create your mapping ?

I already get the same issue but it was due to a wrong install of the attachment plugin.

HTH

David.

De : elasticsearch@googlegroups.com [mailto:elasticsearch@googlegroups.com] De la part de Alexandre Heimburger
Envoyé : mercredi 14 mars 2012 18:51
À : elasticsearch mailing list
Objet : Query string on an attachment field

Hi,

Is it possible to perform a query string on a specific attachment field :

{

"query_string" : {



    "fields" : ["files", "content"],



    "query" : "my text"



}

}

This query should search in the content AND the attachments.

But nothing is returned. If I keep the default field, it's ok.

Am I missing something in the mapping ("files":{"type":"attachment"}) ?

thx

--
cheers,

ahb

You're absolutely right. There was an error with my default analyzer.

Thanks for your time and help David.

Cheers

On Wed, Mar 14, 2012 at 10:45 PM, David Pilato david@pilato.fr wrote:

Based on the previous gist (Test of attachments plugin · GitHub ), I tried to
search on file field (aka the attachment field).****


I searched for :****

curl "${host}/_search?pretty=true" -d '{****

"fields" : ["file"],****

"query" : {****

"query_string" : {****

  "query" : "amplifier"****

}****

},****

"highlight" : {****

"fields" : {****

  "file" : {}****

}****

}****

}'****


And get the result.****


{****

"took" : 81,****

"timed_out" : false,****

"_shards" : {****

"total" : 1,****

"successful" : 1,****

"failed" : 0****

},****

"hits" : {****

"total" : 1,****

"max_score" : 0.005872132,****

"hits" : [ {****

  "_index" : "test",****

  "_type" : "attachment",****

  "_id" : "s_C9wgsCQRKteC4i_WbjjQ",****

  "_score" : 0.005872132,****

  "fields" : {****

    "file" : "[I REMOVED THE PDF CONTENT] "****

  },****

  "highlight" : {****

    "file" : [ "\nMono <em>Amplifier</em>\nThe ISL99201 is a fully

integrate d high efficiency class-D
\nmono amplifier. It is designed" ]****

  }****

} ]****

}****

}****


I really think that your mapping is incorrect. Don’t you see something
strange in logs when you create your mapping ?****


I already get the same issue but it was due to a wrong install of the
attachment plugin.****


HTH****

David.****


De : elasticsearch@googlegroups.com [mailto:
elasticsearch@googlegroups.com] De la part de Alexandre Heimburger
Envoyé : mercredi 14 mars 2012 18:51
À : elasticsearch mailing list
Objet : Query string on an attachment field****


Hi,****


Is it possible to perform a query string on a specific attachment field :*





{



"query_string" : {


    "fields" : ["files", "content"],


    "query" : "my text"


}


}****


This query should search in the content AND the attachments.****


But nothing is returned. If I keep the default field, it's ok.****


Am I missing something in the mapping ("files":{"type":"attachment"}) ?***
*


thx****


--
cheers,****

ahb****

--
Alexandre Heimburger
VP Engineering
blueKiwi Software
tel : +33687880997
email : ahb@bluekiwi-software.com
adress : 93 rue Vieille du Temple, 75003 Paris

blueKiwi is the innovation leader in Enterprise Social Software. Our
solutions enable enterprises worldwide to engage and interact with their
internal and external social networks in multiple business domains.
blueKiwi has been consistently recognized by Gartner Inc. as a visionary
provider since 2007.