Besides stop works, you can use a bool query one clause is the match all,
and the other clause is must not with the terms in question.

Something like:
{
   "query": {
      "bool": {
         "must": [
            {
               "match_all": {}
            }
         ],
         "must_not": [
            {
               "terms": {
                  "string_generic": [
                     "Hash",
                     "video_hash"
                  ]
               }
            }
         ]
      }
   }
}

Lucene used to have a limitation where you could not simply execute a not
query by itself. The trick was simply to use a match all in conjunction
with the not query. Not sure if the limitation still exists (it probably
does), but I find it easier to read if you thrown in the explicit match all.

Cheers,

Ivan



On Thu, Jul 10, 2014 at 7:37 PM, vineeth mohan <[email protected]>
wrote:

> Hi Joaquin ,
>
> I believe you don't want certain words to be indexed.
> If that is the case , add those words as stop words -
> http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-stop-tokenfilter.html
>
> Thanks
>             Vineeth
>
>
> On Fri, Jul 11, 2014 at 3:12 AM, JB Mere <[email protected]> wrote:
>
>>
>> Hello
>>
>> Yes, sure, sorry for being quite unclear. Let me try to explin the issue
>> better:
>>
>> Imagine I'm defining the following mapping:
>> curl -XPUT 'http://localhost:9200/inteco5/inteco5/_mapping' -d '{
>>  "inteco5" : {
>> "dynamic_templates" : [
>> {
>>  "date_fields" : {
>> "match" : "*Date*",
>> "mapping" : {
>>  "type" : "date",
>> "format" : "dateOptionalTime"
>> }
>>  }
>> },
>> {
>> "location": {
>>  "match" : "asasec_loc",
>> "mapping" : {
>>   "type": "geo_point"
>>  }
>> }
>> },
>> {
>>  "string_generic" : {
>> "match" : "*",
>> "unmatch" : "Hash",
>>  "mapping" : {
>> "type" : "string"
>> }
>>  }
>> }
>> ]
>> }
>> }'
>>
>>
>> For sure it works, but what if I want to define in the string part that
>> every keyword shall be string except those keys named Hash AND video_hash ?
>>
>> Then, it should be like
>> "match" : "*",
>> "unmatch" : ["Hash", "video_hash"],
>> but it does not work at all.
>>
>> Hopefully It is now clearer.
>> Do you have any idea on how to specify it?
>>
>> Thanks a lot.
>>
>> Joaquin
>>
>>
>>
>>
>> El jueves, 10 de julio de 2014 19:47:01 UTC+2, vineeth mohan escribió:
>>>
>>> Hello Joaquin ,
>>>
>>> Your question is not very clear.
>>> Can you brief it once more.
>>>
>>> Thanks
>>>            Vineeth
>>>
>>>
>>> On Thu, Jul 10, 2014 at 9:58 PM, JB Mere <[email protected]> wrote:
>>>
>>>>  Hello to everybody and sorry for this, maybe naive question.
>>>>
>>>> I'm defining a mapping for an ES 1.X index database
>>>>
>>>> My interest should be to do like:
>>>> ...
>>>> "unmatch" : ["Hash","video_hash"],
>>>> "match" : "*",
>>>> ...
>>>>
>>>> but unfortunately it doesn't work?
>>>>
>>>> Can you figure out how to get it done ?
>>>>
>>>> Thanks in advance
>>>>
>>>> Joaquin
>>>>
>>>> --
>>>> 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 [email protected].
>>>>
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/elasticsearch/6c6fbcf6-40b4-447f-b09d-5d74ad67a1a9%
>>>> 40googlegroups.com
>>>> <https://groups.google.com/d/msgid/elasticsearch/6c6fbcf6-40b4-447f-b09d-5d74ad67a1a9%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elasticsearch/497dff13-514d-4944-8d2f-0c1146d05487%40googlegroups.com
>> <https://groups.google.com/d/msgid/elasticsearch/497dff13-514d-4944-8d2f-0c1146d05487%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/CAGdPd5nd%3DnJpoGZdAprKsoFH0b8jJjB4D2LbDQiU5SmkzAnJMA%40mail.gmail.com
> <https://groups.google.com/d/msgid/elasticsearch/CAGdPd5nd%3DnJpoGZdAprKsoFH0b8jJjB4D2LbDQiU5SmkzAnJMA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDkW4J6ZxyeCdQLgq%3DKub80V0F8HiTe8oxDa5SywkNiWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to